[frogr] Make the toolbar items work (associate them to actions)



commit b208e6fb152f58d8fcbc850d79826d076998b02e
Author: Mario Sanchez Prada <msanchez gnome org>
Date:   Thu Dec 19 08:21:27 2013 +0000

    Make the toolbar items work (associate them to actions)

 src/frogr-main-view.c |   23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)
---
diff --git a/src/frogr-main-view.c b/src/frogr-main-view.c
index ccd412d..5a1c689 100644
--- a/src/frogr-main-view.c
+++ b/src/frogr-main-view.c
@@ -130,7 +130,7 @@ enum {
 /* Prototypes */
 
 static void _initialize_ui (FrogrMainView *self);
-static GtkToolItem *_create_toolbar_item (const gchar *icon_name, const gchar *label, const gchar 
*tooltip_text);
+static GtkToolItem *_create_toolbar_item (const gchar *action_name, const gchar *icon_name, const gchar 
*label, const gchar *tooltip_text);
 static gboolean _maybe_show_auth_dialog_on_idle (FrogrMainView *self);
 
 static void _update_project_path (FrogrMainView *self, const gchar *path);
@@ -390,19 +390,19 @@ _initialize_ui (FrogrMainView *self)
 
   /* Toolbar */
   toolbar = GTK_WIDGET (gtk_builder_get_object (builder, "toolbar"));
-  toolbar_item = _create_toolbar_item ("gtk-open", _("Open"), _("Open Existing Project"));
+  toolbar_item = _create_toolbar_item ("win.open-project", "gtk-open", _("Open"), _("Open Existing 
Project"));
   gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolbar_item, 0);
-  toolbar_item = _create_toolbar_item ("gtk-save", _("Save"), _("Save Current Project"));
+  toolbar_item = _create_toolbar_item ("win.save-project", "gtk-save", _("Save"), _("Save Current Project"));
   gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolbar_item, 1);
   toolbar_item = gtk_separator_tool_item_new ();
   gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolbar_item, 2);
-  toolbar_item = _create_toolbar_item ("gtk-add", _("Add"), _("Add Elements"));
+  toolbar_item = _create_toolbar_item ("win.add-pictures", "gtk-add", _("Add"), _("Add Elements"));
   gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolbar_item, 3);
-  toolbar_item = _create_toolbar_item ("gtk-remove", _("Remove"), _("Remove Elements"));
+  toolbar_item = _create_toolbar_item ("win.remove-pictures", "gtk-remove", _("Remove"), _("Remove 
Elements"));
   gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolbar_item, 4);
   toolbar_item = gtk_separator_tool_item_new ();
   gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolbar_item, 5);
-  toolbar_item = _create_toolbar_item ("gtk-go-up", _("Upload"), _("Upload All"));
+  toolbar_item = _create_toolbar_item ("win.upload-all", "gtk-go-up", _("Upload"), _("Upload All"));
   gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolbar_item, 6);
   gtk_style_context_add_class (gtk_widget_get_style_context (toolbar),
                                GTK_STYLE_CLASS_PRIMARY_TOOLBAR);
@@ -548,16 +548,17 @@ _initialize_ui (FrogrMainView *self)
 }
 
 static GtkToolItem *
-_create_toolbar_item (const gchar *icon_name, const gchar *label, const gchar *tooltip_text)
+_create_toolbar_item (const gchar *action_name, const gchar *icon_name, const gchar *label, const gchar 
*tooltip_text)
 {
   GtkWidget *widget = NULL;
-  GtkToolItem *toolbar_item = NULL;
+  GtkToolItem *item = NULL;
 
   widget = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_SMALL_TOOLBAR);
-  toolbar_item = gtk_tool_button_new (widget, label);
-  gtk_tool_item_set_tooltip_text (toolbar_item, tooltip_text);
+  item = gtk_tool_button_new (widget, label);
+  gtk_tool_item_set_tooltip_text (item, tooltip_text);
+  gtk_actionable_set_action_name (GTK_ACTIONABLE (item), action_name);
 
-  return toolbar_item;
+  return item;
 }
 
 static gboolean


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