[gnumeric] Add function help menu item. [#156777]



commit 4cc3daf47855593957f5820295ef38531dbf5340
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Wed Jun 9 01:57:15 2010 -0600

    Add function help menu item. [#156777]
    
    2010-06-09 Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* component/Gnumeric-embed.xml.in: add Function Help
    	* src/GNOME_Gnumeric-gtk.xml.in: ditto
    	* src/HILDON_Gnumeric-gtk.xml.in: ditto
    	* src/wbc-gtk-actions.c (cb_help_function): new
    	(permanent_actions): attach cb_help_function
    
    2010-06-09 Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* function-select.glade: add close button
    	* dialog-function-select.c (dialog_function_select_init):
    	  show and hide the appropriate widgets depending on whether
    	  we are in help mode
    	(cb_dialog_function_select_ok_clicked): only called the
    	  formula guru if we aren't in help mode
    	(dialog_function_select): don't show the purposefully hidden
    	  widgets

 ChangeLog                            |    8 ++++++++
 NEWS                                 |    1 +
 component/Gnumeric-embed.xml.in      |    1 +
 src/GNOME_Gnumeric-gtk.xml.in        |    1 +
 src/HILDON_Gnumeric-gtk.xml.in       |    3 +++
 src/dialogs/ChangeLog                |   11 +++++++++++
 src/dialogs/dialog-function-select.c |   31 ++++++++++++++++++++++++-------
 src/dialogs/function-select.glade    |   26 ++++++++++++++++++++------
 src/wbc-gtk-actions.c                |    4 ++++
 9 files changed, 73 insertions(+), 13 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index bb9e0c6..674f637 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-06-09 Andreas J. Guelzow <aguelzow pyrshep ca>
+	
+	* component/Gnumeric-embed.xml.in: add Function Help
+	* src/GNOME_Gnumeric-gtk.xml.in: ditto
+	* src/HILDON_Gnumeric-gtk.xml.in: ditto
+	* src/wbc-gtk-actions.c (cb_help_function): new
+	(permanent_actions): attach cb_help_function
+
 2010-06-07 Andreas J. Guelzow <aguelzow pyrshep ca>
 	for Konstantin Tokarev
 
diff --git a/NEWS b/NEWS
index 9b6719d..4aabfec 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,7 @@ Andreas:
 	* Ensure that names cannot be mistaken as cell references.
 	  [#409997]
 	* Add search function to function selector. [#495776]
+	* Add function help menu item. [#156777]
 
 Jean:
 	* Do not ungrab a not grabbed item. [#620369]
diff --git a/component/Gnumeric-embed.xml.in b/component/Gnumeric-embed.xml.in
index 5b9ef9e..fcf21ea 100644
--- a/component/Gnumeric-embed.xml.in
+++ b/component/Gnumeric-embed.xml.in
@@ -264,6 +264,7 @@
     </menu>
     <menu name="Help" action="MenuHelp">
       <menuitem action="HelpDocs"/>
+      <menuitem action="HelpFunctions"/>
       <menuitem action="HelpWeb"/>
       <menuitem action="HelpIRC"/>
       <menuitem action="HelpBug"/>
diff --git a/src/GNOME_Gnumeric-gtk.xml.in b/src/GNOME_Gnumeric-gtk.xml.in
index 7a0ea8d..e79f34c 100644
--- a/src/GNOME_Gnumeric-gtk.xml.in
+++ b/src/GNOME_Gnumeric-gtk.xml.in
@@ -266,6 +266,7 @@
     </menu>
     <menu name="Help" action="MenuHelp">
       <menuitem action="HelpDocs"/>
+      <menuitem action="HelpFunctions"/>
       <menuitem action="HelpWeb"/>
       <menuitem action="HelpIRC"/>
       <menuitem action="HelpBug"/>
diff --git a/src/HILDON_Gnumeric-gtk.xml.in b/src/HILDON_Gnumeric-gtk.xml.in
index 2e9ec59..61808dc 100644
--- a/src/HILDON_Gnumeric-gtk.xml.in
+++ b/src/HILDON_Gnumeric-gtk.xml.in
@@ -260,6 +260,9 @@
     <menu name="Help" action="MenuHelp">
 <!--
       <menuitem action="HelpDocs"/>
+-->
+      <menuitem action="HelpFunctions"/>
+<!--
       <menuitem action="HelpWeb"/>
       <menuitem action="HelpIRC"/>
       <menuitem action="HelpBug"/>
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 24e0f6a..b46d039 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,5 +1,16 @@
 2010-06-09 Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* function-select.glade: add close button
+	* dialog-function-select.c (dialog_function_select_init):
+	  show and hide the appropriate widgets depending on whether
+	  we are in help mode
+	(cb_dialog_function_select_ok_clicked): only called the 
+	  formula guru if we aren't in help mode
+	(dialog_function_select): don't show the purposefully hidden
+	  widgets
+
+2010-06-09 Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* dialog-function-select.c (cb_unref): new
 	(cb_dialog_function_select_search_all): handle "in use" 
 	  selection
diff --git a/src/dialogs/dialog-function-select.c b/src/dialogs/dialog-function-select.c
index a398958..be8040e 100644
--- a/src/dialogs/dialog-function-select.c
+++ b/src/dialogs/dialog-function-select.c
@@ -341,7 +341,8 @@ cb_dialog_function_select_ok_clicked (G_GNUC_UNUSED GtkWidget *button,
 	GnmFunc const *func;
 	GtkTreeSelection *the_selection = gtk_tree_view_get_selection (state->treeview);
 
-	if (gtk_tree_selection_get_selected (the_selection, &model, &iter)) {
+	if (state->formula_guru_key != NULL && 
+	    gtk_tree_selection_get_selected (the_selection, &model, &iter)) {
 		WBCGtk *wbcg = state->wbcg;
 		gtk_tree_model_get (model, &iter,
 				    FUNCTION, &func,
@@ -353,7 +354,6 @@ cb_dialog_function_select_ok_clicked (G_GNUC_UNUSED GtkWidget *button,
 		return;
 	}
 
-	g_assert_not_reached ();
 	gtk_widget_destroy (state->dialog);
 	return;
 }
@@ -1014,6 +1014,9 @@ dialog_function_select_init (FunctionSelectState *state)
 	GtkTextIter where;
 	GtkTextBuffer *description;
 	GtkCellRenderer *cell;
+	GtkWidget *cancel_button;
+	GtkWidget *close_button;
+	gboolean help_mode;
 
 	g_object_set_data (G_OBJECT (state->dialog), FUNCTION_SELECT_DIALOG_KEY,
 			   state);
@@ -1033,7 +1036,6 @@ dialog_function_select_init (FunctionSelectState *state)
 	gtk_combo_box_set_row_separator_func 
 		(state->cb, dialog_function_select_cat_row_separator,
 		 state, NULL);
-	gtk_combo_box_set_active (state->cb, 0);
 	g_signal_connect (state->cb, "changed", 
 			  G_CALLBACK (dialog_function_select_cat_changed),
 			  state);
@@ -1129,9 +1131,11 @@ dialog_function_select_init (FunctionSelectState *state)
 	g_signal_connect (G_OBJECT (state->ok_button),
 		"clicked",
 		G_CALLBACK (cb_dialog_function_select_ok_clicked), state);
-	g_signal_connect (G_OBJECT 
-			  (glade_xml_get_widget (state->gui, "cancel_button")),
-		"clicked",
+	cancel_button = glade_xml_get_widget (state->gui, "cancel_button");
+	g_signal_connect (G_OBJECT (cancel_button), "clicked",
+		G_CALLBACK (cb_dialog_function_select_cancel_clicked), state);
+	close_button = glade_xml_get_widget (state->gui, "close_button");
+	g_signal_connect (G_OBJECT (close_button), "clicked",
 		G_CALLBACK (cb_dialog_function_select_cancel_clicked), state);
 
 	gnm_dialog_setup_destroy_handlers 
@@ -1146,6 +1150,19 @@ dialog_function_select_init (FunctionSelectState *state)
 		(G_OBJECT (state->dialog),
 		 "state", state, 
 		 (GDestroyNotify) cb_dialog_function_select_destroy);
+
+	help_mode = (state->formula_guru_key == NULL);
+
+	gtk_widget_set_visible (close_button, help_mode);
+	gtk_widget_set_visible (glade_xml_get_widget 
+				(state->gui, "help_button"), 
+				!help_mode);
+	gtk_widget_set_visible (cancel_button, !help_mode);
+	gtk_widget_set_visible (state->ok_button, !help_mode);
+	gtk_widget_set_visible (glade_xml_get_widget 
+				(state->gui, "title_label"), 
+				!help_mode);
+	gtk_combo_box_set_active (state->cb, help_mode ? 2 : 0);
 }
 
 void
@@ -1176,5 +1193,5 @@ dialog_function_select (WBCGtk *wbcg, char const *key)
 	gnumeric_keyed_dialog (state->wbcg, GTK_WINDOW (state->dialog),
 			       FUNCTION_SELECT_KEY);
 
-	gtk_widget_show_all (state->dialog);
+	gtk_widget_show (state->dialog);
 }
diff --git a/src/dialogs/function-select.glade b/src/dialogs/function-select.glade
index 4c3aeca..d2fe3a3 100644
--- a/src/dialogs/function-select.glade
+++ b/src/dialogs/function-select.glade
@@ -14,7 +14,7 @@
         <property name="visible">True</property>
         <property name="spacing">2</property>
         <child>
-          <widget class="GtkLabel" id="label4">
+          <widget class="GtkLabel" id="title_label">
             <property name="visible">True</property>
             <property name="xalign">0</property>
             <property name="label" translatable="yes">Select a function to insert:</property>
@@ -26,9 +26,6 @@
           </packing>
         </child>
         <child>
-          <placeholder/>
-        </child>
-        <child>
           <widget class="GtkVPaned" id="vpaned1">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
@@ -153,6 +150,9 @@
             <property name="position">2</property>
           </packing>
         </child>
+        <child>
+          <placeholder/>
+        </child>
         <child internal-child="action_area">
           <widget class="GtkHButtonBox" id="dialog-action_area1">
             <property name="visible">True</property>
@@ -173,6 +173,20 @@
               </packing>
             </child>
             <child>
+              <widget class="GtkButton" id="close_button">
+                <property name="label">gtk-close</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
               <widget class="GtkButton" id="cancel_button">
                 <property name="label">gtk-cancel</property>
                 <property name="visible">True</property>
@@ -184,7 +198,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">1</property>
+                <property name="position">2</property>
               </packing>
             </child>
             <child>
@@ -198,7 +212,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">2</property>
+                <property name="position">3</property>
               </packing>
             </child>
           </widget>
diff --git a/src/wbc-gtk-actions.c b/src/wbc-gtk-actions.c
index 04f3b1f..1f9e170 100644
--- a/src/wbc-gtk-actions.c
+++ b/src/wbc-gtk-actions.c
@@ -996,6 +996,7 @@ static GNM_ACTION_DEF (cb_data_show_detail)	{ hide_show_detail (wbcg, TRUE); }
 static GNM_ACTION_DEF (cb_data_group)		{ group_ungroup_colrow (wbcg, TRUE); }
 static GNM_ACTION_DEF (cb_data_ungroup)		{ group_ungroup_colrow (wbcg, FALSE); }
 
+static GNM_ACTION_DEF (cb_help_function)	{ dialog_function_select (wbcg, NULL); }
 static GNM_ACTION_DEF (cb_help_docs)
 {
 	char   *argv[] = { NULL, NULL, NULL };
@@ -1825,6 +1826,9 @@ static GtkActionEntry const permanent_actions[] = {
 	{ "HelpDocs", GTK_STOCK_HELP, N_("_Contents"),
 		"F1", N_("Open a viewer for Gnumeric's documentation"),
 		G_CALLBACK (cb_help_docs) },
+	{ "HelpFunctions", NULL, N_("_Functions"),
+		NULL, N_("Functions help"),
+		G_CALLBACK (cb_help_function) },
 	{ "HelpWeb", NULL, N_("Gnumeric on the _Web"),
 		NULL, N_("Browse to Gnumeric's website"),
 		G_CALLBACK (cb_help_web) },



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]