[anjuta] snippets-manager: Move buttons to grip



commit 9bc2a2078539935c8e82cce2394ff5ccbd8d9a2b
Author: Johannes Schmid <jhs gnome org>
Date:   Mon Aug 16 21:59:27 2010 +0200

    snippets-manager: Move buttons to grip

 plugins/snippets-manager/plugin.c            |    3 +-
 plugins/snippets-manager/snippets-browser.c  |   31 ++++++++-
 plugins/snippets-manager/snippets-browser.h  |    2 +
 plugins/snippets-manager/snippets-browser.ui |   93 +++-----------------------
 4 files changed, 41 insertions(+), 88 deletions(-)
---
diff --git a/plugins/snippets-manager/plugin.c b/plugins/snippets-manager/plugin.c
index 5c678e6..2778c02 100644
--- a/plugins/snippets-manager/plugin.c
+++ b/plugins/snippets-manager/plugin.c
@@ -286,11 +286,12 @@ snippets_manager_activate (AnjutaPlugin * plugin)
 	snippets_browser_load (snippets_manager_plugin->snippets_browser,
 	                       snippets_manager_plugin->snippets_db,
 	                       snippets_manager_plugin->snippets_interaction);
-	anjuta_shell_add_widget (plugin->shell,
+	anjuta_shell_add_widget_custom (plugin->shell,
 	                         GTK_WIDGET (snippets_manager_plugin->snippets_browser),
 	                         "snippets_browser",
 	                         _("Snippets"),
 	                         GTK_STOCK_FILE,
+	                         snippets_browser_get_grip (snippets_manager_plugin->snippets_browser),
 	                         ANJUTA_SHELL_PLACEMENT_LEFT,
 	                         NULL);
     snippets_manager_plugin->browser_maximized = FALSE;
diff --git a/plugins/snippets-manager/snippets-browser.c b/plugins/snippets-manager/snippets-browser.c
index 69518cc..5efb485 100644
--- a/plugins/snippets-manager/snippets-browser.c
+++ b/plugins/snippets-manager/snippets-browser.c
@@ -46,6 +46,8 @@ struct _SnippetsBrowserPrivate
 	GtkButton *insert_button;
 	GtkToggleButton *edit_button;
 
+	GtkWidget *grip;
+
 	GtkVBox *snippets_view_vbox;
 	GtkScrolledWindow *snippets_view_cont;
 	
@@ -186,13 +188,30 @@ init_browser_layout (SnippetsBrowser *snippets_browser)
 	}
 
 	/* Get the Gtk objects */
-	priv->add_button      = GTK_BUTTON (gtk_builder_get_object (bxml, "add_button"));
-	priv->delete_button   = GTK_BUTTON (gtk_builder_get_object (bxml, "delete_button"));
-	priv->insert_button   = GTK_BUTTON (gtk_builder_get_object (bxml, "insert_button"));
+	priv->add_button      = GTK_BUTTON(gtk_button_new());
+	gtk_container_add (GTK_CONTAINER (priv->add_button),
+	                   gtk_image_new_from_stock (GTK_STOCK_ADD,
+	                                             GTK_ICON_SIZE_MENU));
+	priv->delete_button      = GTK_BUTTON(gtk_button_new());
+	gtk_container_add (GTK_CONTAINER (priv->delete_button),
+	                   gtk_image_new_from_stock (GTK_STOCK_DELETE,
+	                                             GTK_ICON_SIZE_MENU));
+	priv->insert_button      = GTK_BUTTON(gtk_button_new());
+	gtk_container_add (GTK_CONTAINER (priv->insert_button),
+	                   gtk_image_new_from_stock (GTK_STOCK_PASTE,
+	                                             GTK_ICON_SIZE_MENU));
+	priv->grip = gtk_hbox_new (FALSE, 5);
 	priv->edit_button     = GTK_TOGGLE_BUTTON (gtk_builder_get_object (bxml, "edit_button"));
 	priv->snippets_view_cont = GTK_SCROLLED_WINDOW (gtk_builder_get_object (bxml, "snippets_view_cont"));
 	priv->snippets_view_vbox = GTK_VBOX (gtk_builder_get_object (bxml, "snippets_view_vbox"));
 
+	gtk_box_pack_start (GTK_BOX (priv->grip), gtk_label_new (_("Snippets")), FALSE, FALSE, 5);
+	gtk_box_pack_end (GTK_BOX (priv->grip), GTK_WIDGET(priv->insert_button), FALSE, FALSE, 1);	
+	gtk_box_pack_end (GTK_BOX (priv->grip), GTK_WIDGET(priv->delete_button), FALSE, FALSE, 1);
+	gtk_box_pack_end (GTK_BOX (priv->grip), GTK_WIDGET(priv->add_button), FALSE, FALSE, 1);	
+
+	gtk_widget_show_all (priv->grip);
+	
 	/* Assert the objects */
 	g_return_if_fail (GTK_IS_BUTTON (priv->add_button));
 	g_return_if_fail (GTK_IS_BUTTON (priv->delete_button));
@@ -1188,3 +1207,9 @@ on_snippets_editor_close_request (SnippetsEditor *snippets_editor,
 
 	gtk_toggle_button_set_active (priv->edit_button, FALSE);
 }
+
+GtkWidget*
+snippets_browser_get_grip (SnippetsBrowser *snippets_browser)
+{
+	return snippets_browser->priv->grip;
+}
\ No newline at end of file
diff --git a/plugins/snippets-manager/snippets-browser.h b/plugins/snippets-manager/snippets-browser.h
index 78c01ba..b49ff95 100644
--- a/plugins/snippets-manager/snippets-browser.h
+++ b/plugins/snippets-manager/snippets-browser.h
@@ -77,5 +77,7 @@ void                   snippets_browser_show_editor            (SnippetsBrowser
 void                   snippets_browser_hide_editor            (SnippetsBrowser *snippets_browser);
 void                   snippets_browser_refilter_snippets_view (SnippetsBrowser *snippets_browser);
 
+GtkWidget*             snippets_browser_get_grip               (SnippetsBrowser *snippets_browser);
+
 #endif /* __SNIPPETS_BROWSER_H__ */
 
diff --git a/plugins/snippets-manager/snippets-browser.ui b/plugins/snippets-manager/snippets-browser.ui
index 90efe98..027484a 100644
--- a/plugins/snippets-manager/snippets-browser.ui
+++ b/plugins/snippets-manager/snippets-browser.ui
@@ -22,95 +22,20 @@
           </packing>
         </child>
         <child>
-          <object class="GtkHBox" id="hbox2">
-            <property name="height_request">26</property>
+          <object class="GtkToggleButton" id="edit_button">
+            <property name="label">gtk-edit</property>
+            <property name="width_request">36</property>
+            <property name="height_request">24</property>
             <property name="visible">True</property>
-            <child>
-              <object class="GtkButton" id="add_button">
-                <property name="label" translatable="yes">Add</property>
-                <property name="width_request">60</property>
-                <property name="height_request">24</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="padding">6</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="delete_button">
-                <property name="label" translatable="yes">Delete</property>
-                <property name="width_request">60</property>
-                <property name="height_request">24</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="padding">6</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="insert_button">
-                <property name="label" translatable="yes">Insert</property>
-                <property name="width_request">60</property>
-                <property name="height_request">24</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="yalign">0.46000000834465027</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="padding">6</property>
-                <property name="position">2</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkVSeparator" id="vseparator1">
-                <property name="visible">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="pack_type">end</property>
-                <property name="position">3</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkToggleButton" id="edit_button">
-                <property name="width_request">36</property>
-                <property name="height_request">24</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <child>
-                  <object class="GtkImage" id="image3">
-                    <property name="visible">True</property>
-                    <property name="stock">gtk-edit</property>
-                  </object>
-                </child>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="padding">5</property>
-                <property name="pack_type">end</property>
-                <property name="position">3</property>
-              </packing>
-            </child>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="use_stock">True</property>
           </object>
           <packing>
             <property name="expand">False</property>
             <property name="fill">False</property>
-            <property name="padding">2</property>
+            <property name="padding">5</property>
+            <property name="pack_type">end</property>
             <property name="position">1</property>
           </packing>
         </child>



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