[anjuta] project-manager: Small fixes on project manager dialog



commit 0ebda8d532db9854879305f6399492e0b15e6817
Author: SÃbastien Granjoux <seb sfo free fr>
Date:   Fri Jan 20 22:51:55 2012 +0100

    project-manager: Small fixes on project manager dialog
    
    Add a help button in all dialogs
    Remove shorcut from add target tree view
    Fix New Library button in the Add Library dialog

 plugins/project-manager/dialogs.c     |   62 +++++++++++++++++++++-----------
 plugins/project-manager/plugin.c      |   29 ++++++++-------
 plugins/project-manager/plugin.h      |    3 ++
 plugins/project-manager/pm_dialogs.ui |   48 ++++++++++++++++++++++---
 4 files changed, 101 insertions(+), 41 deletions(-)
---
diff --git a/plugins/project-manager/dialogs.c b/plugins/project-manager/dialogs.c
index 8a6c80a..e571567 100644
--- a/plugins/project-manager/dialogs.c
+++ b/plugins/project-manager/dialogs.c
@@ -42,9 +42,11 @@
 #define GLADE_FILE  PACKAGE_DATA_DIR "/glade/pm_dialogs.ui"
 
 #define ANJUTA_MANUAL	"anjuta-manual"
-#define ADD_SOURCE_HELP	"anjuta-project-files"
-#define ADD_TARGET_HELP	"project-manager-target"
-#define ADD_PACKAGE_HELP "project-manager-module"
+#define ADD_SOURCE_HELP	"project-manager-source-add"
+#define ADD_TARGET_HELP	"project-manager-target-add"
+#define ADD_PACKAGE_HELP "project-manager-module-new"
+#define ADD_MODULE_HELP "project-manager-module-add"
+#define ADD_FOLDER_HELP "project-manager-folder-add"
 
 
 /* Types
@@ -194,20 +196,26 @@ parent_filter_func (GtkTreeModel *model, GtkTreeIter *iter, gpointer user_data)
 
 	gtk_tree_model_get (model, iter,
 						GBF_PROJECT_MODEL_COLUMN_DATA, &data, -1);
-	node = data == NULL ? NULL : gbf_tree_data_get_node (data);
-	if (node != NULL)
+	if (data->shortcut != NULL)
 	{
-		if (anjuta_project_node_get_state (node) & need)
-		{
-			/* Current node can be used as parent */
-			visible = TRUE;
-		}
-		else if (anjuta_project_node_get_node_type (node) == type)
+		visible = FALSE;
+	}
+	else
+	{
+		node = data == NULL ? NULL : gbf_tree_data_get_node (data);
+		if (node != NULL)
 		{
-			/* Check if node can be used as sibling */
-			parent = anjuta_project_node_parent (node);
-			visible = anjuta_project_node_get_state (parent) & need ? TRUE : FALSE;
-
+			if (anjuta_project_node_get_state (node) & need)
+			{
+				/* Current node can be used as parent */
+				visible = TRUE;
+			}
+			else if (anjuta_project_node_get_node_type (node) == type)
+			{
+				/* Check if node can be used as sibling */
+				parent = anjuta_project_node_parent (node);
+				visible = anjuta_project_node_get_state (parent) & need ? TRUE : FALSE;
+			}
 		}
 	}
 
@@ -994,6 +1002,9 @@ anjuta_pm_project_new_group (ProjectManagerPlugin *plugin, GtkWindow *parent, Gt
 				g_free (name);
 				break;
 			}
+			case GTK_RESPONSE_HELP:
+				anjuta_util_help_display (GTK_WIDGET (dialog), ANJUTA_MANUAL, ADD_FOLDER_HELP);
+				break;
 			default:
 				finished = TRUE;
 				break;
@@ -1592,6 +1603,16 @@ on_cursor_changed(GtkTreeView* view, gpointer data)
 		gtk_widget_set_sensitive(button, FALSE);
 }
 
+static void
+on_new_library(GtkButton *button, gpointer user_data)
+{
+	ProjectManagerPlugin *plugin = ANJUTA_PLUGIN_PROJECT_MANAGER (user_data);
+	anjuta_pm_project_new_package (plugin,
+	                               get_plugin_parent_window (plugin),
+	                               NULL,
+	                               NULL);
+}
+
 GList*
 anjuta_pm_project_new_module (ProjectManagerPlugin *plugin,
                              GtkWindow          *parent,
@@ -1649,6 +1670,8 @@ anjuta_pm_project_new_module (ProjectManagerPlugin *plugin,
 	}
 	g_signal_connect (G_OBJECT(modules_view), "cursor-changed",
 						G_CALLBACK(on_cursor_changed), ok_button);
+	g_signal_connect (G_OBJECT(new_button), "clicked",
+	                	G_CALLBACK(on_new_library), plugin);
 
 
 	if (parent)
@@ -1664,12 +1687,6 @@ anjuta_pm_project_new_module (ProjectManagerPlugin *plugin,
 		response = gtk_dialog_run (GTK_DIALOG (dialog));
 
 		switch (response) {
-			case 1:
-			{
-				anjuta_pm_project_new_package (plugin, parent, NULL, NULL);
-
-				break;
-			}
 			case GTK_RESPONSE_OK:
 			{
 				GFile *target_file;
@@ -1726,6 +1743,9 @@ anjuta_pm_project_new_module (ProjectManagerPlugin *plugin,
 
 				break;
 			}
+			case GTK_RESPONSE_HELP:
+				anjuta_util_help_display (GTK_WIDGET (dialog), ANJUTA_MANUAL, ADD_MODULE_HELP);
+				break;
 			default:
 				finished = TRUE;
 				break;
diff --git a/plugins/project-manager/plugin.c b/plugins/project-manager/plugin.c
index 6af0632..c207028 100644
--- a/plugins/project-manager/plugin.c
+++ b/plugins/project-manager/plugin.c
@@ -68,20 +68,6 @@ static gboolean file_is_inside_project (ProjectManagerPlugin *plugin,
 									   GFile *uri);
 static void project_manager_plugin_close (ProjectManagerPlugin *plugin);
 
-static GtkWindow*
-get_plugin_parent_window (ProjectManagerPlugin *plugin)
-{
-	GtkWindow *win;
-	GtkWidget *toplevel;
-
-	toplevel = gtk_widget_get_toplevel (plugin->scrolledwindow);
-	if (toplevel && GTK_IS_WINDOW (toplevel))
-		win = GTK_WINDOW (toplevel);
-	else
-		win = GTK_WINDOW (ANJUTA_PLUGIN (plugin)->shell);
-	return win;
-}
-
 static void
 update_title (ProjectManagerPlugin* plugin, const gchar *project_uri)
 {
@@ -386,6 +372,21 @@ update_operation_begin (ProjectManagerPlugin *plugin)
 										  NULL);
 }
 
+GtkWindow*
+get_plugin_parent_window (ProjectManagerPlugin *plugin)
+{
+	GtkWindow *win;
+	GtkWidget *toplevel;
+
+	toplevel = gtk_widget_get_toplevel (plugin->scrolledwindow);
+	if (toplevel && GTK_IS_WINDOW (toplevel))
+		win = GTK_WINDOW (toplevel);
+	else
+		win = GTK_WINDOW (ANJUTA_PLUGIN (plugin)->shell);
+	return win;
+}
+
+
 /* GUI callbacks
  *---------------------------------------------------------------------------*/
 
diff --git a/plugins/project-manager/plugin.h b/plugins/project-manager/plugin.h
index 63a667d..7851468 100644
--- a/plugins/project-manager/plugin.h
+++ b/plugins/project-manager/plugin.h
@@ -83,4 +83,7 @@ struct _ProjectManagerPluginClass{
 	AnjutaPluginClass parent_class;
 };
 
+GtkWindow* get_plugin_parent_window (ProjectManagerPlugin *plugin);
+
+
 #endif
diff --git a/plugins/project-manager/pm_dialogs.ui b/plugins/project-manager/pm_dialogs.ui
index 06dffb3..c7407a9 100644
--- a/plugins/project-manager/pm_dialogs.ui
+++ b/plugins/project-manager/pm_dialogs.ui
@@ -24,6 +24,23 @@
             <property name="can_focus">False</property>
             <property name="layout_style">end</property>
             <child>
+              <object class="GtkButton" id="button8">
+                <property name="label">gtk-help</property>
+                <property name="use_action_appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+                <property name="secondary">True</property>
+              </packing>
+            </child>
+            <child>
               <object class="GtkButton" id="button1">
                 <property name="label">gtk-cancel</property>
                 <property name="use_action_appearance">False</property>
@@ -37,7 +54,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">0</property>
+                <property name="position">1</property>
               </packing>
             </child>
             <child>
@@ -55,7 +72,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">1</property>
+                <property name="position">2</property>
               </packing>
             </child>
           </object>
@@ -190,6 +207,7 @@
       </object>
     </child>
     <action-widgets>
+      <action-widget response="-11">button8</action-widget>
       <action-widget response="-6">button1</action-widget>
       <action-widget response="-5">ok_module_button</action-widget>
     </action-widgets>
@@ -566,6 +584,23 @@
             <property name="can_default">True</property>
             <property name="layout_style">end</property>
             <child>
+              <object class="GtkButton" id="button9">
+                <property name="label">gtk-help</property>
+                <property name="use_action_appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+                <property name="secondary">True</property>
+              </packing>
+            </child>
+            <child>
               <object class="GtkButton" id="cancel_button">
                 <property name="label">gtk-cancel</property>
                 <property name="use_action_appearance">False</property>
@@ -579,7 +614,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">0</property>
+                <property name="position">1</property>
               </packing>
             </child>
             <child>
@@ -597,7 +632,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">1</property>
+                <property name="position">2</property>
               </packing>
             </child>
           </object>
@@ -710,6 +745,7 @@
       </object>
     </child>
     <action-widgets>
+      <action-widget response="-11">button9</action-widget>
       <action-widget response="-6">cancel_button</action-widget>
       <action-widget response="-5">ok_group_button</action-widget>
     </action-widgets>
@@ -1171,7 +1207,7 @@
         <property name="use_action_appearance">False</property>
       </object>
       <packing>
-        <property name="expand">True</property>
+        <property name="expand">False</property>
         <property name="fill">True</property>
         <property name="position">0</property>
       </packing>
@@ -1300,7 +1336,7 @@
                   </object>
                   <packing>
                     <property name="expand">True</property>
-                    <property name="fill">False</property>
+                    <property name="fill">True</property>
                     <property name="position">1</property>
                   </packing>
                 </child>



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