[frogr] Handle GtkActions by name, and make them consistent with GActions
- From: Mario Sanchez Prada <msanchez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [frogr] Handle GtkActions by name, and make them consistent with GActions
- Date: Tue, 27 Nov 2012 10:49:47 +0000 (UTC)
commit db5017ca841662fd55cdbc57e60dec263598a39b
Author: Mario Sanchez Prada <msanchez gnome org>
Date: Sun Nov 25 08:59:00 2012 +0100
Handle GtkActions by name, and make them consistent with GActions
data/gtkbuilder/frogr-main-view.xml | 50 ++++++++++++++++----------------
src/frogr-main-view.c | 53 +++++++++++++++++------------------
2 files changed, 51 insertions(+), 52 deletions(-)
---
diff --git a/data/gtkbuilder/frogr-main-view.xml b/data/gtkbuilder/frogr-main-view.xml
index 2b37d0b..e9d458d 100644
--- a/data/gtkbuilder/frogr-main-view.xml
+++ b/data/gtkbuilder/frogr-main-view.xml
@@ -1,56 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="2.16"/>
- <object class="GtkAction" id="open_project_action">
+ <object class="GtkAction" id="open-project">
<property name="label" translatable="yes">_Open Projectâ</property>
<property name="stock_id">gtk-open</property>
<signal name="activate" handler="_on_gtk_action_activated" swapped="no"/>
</object>
- <object class="GtkAction" id="save_project_action">
+ <object class="GtkAction" id="save-project">
<property name="label" translatable="yes">_Save Project</property>
<property name="stock_id">gtk-save</property>
<signal name="activate" handler="_on_gtk_action_activated" swapped="no"/>
</object>
- <object class="GtkAction" id="save_project_as_action">
+ <object class="GtkAction" id="save-project-as">
<property name="label" translatable="yes">Save Project _Asâ</property>
<property name="stock_id">gtk-save-as</property>
<signal name="activate" handler="_on_gtk_action_activated" swapped="no"/>
</object>
- <object class="GtkAction" id="load_pictures_action">
+ <object class="GtkAction" id="load-pictures">
<property name="label" translatable="yes">_Load Picturesâ</property>
<property name="stock_id">gtk-add</property>
<signal name="activate" handler="_on_gtk_action_activated" swapped="no"/>
</object>
- <object class="GtkAction" id="add_tags_action">
+ <object class="GtkAction" id="add-tags">
<property name="label" translatable="yes">Add _Tagsâ</property>
<signal name="activate" handler="_on_gtk_action_activated" swapped="no"/>
</object>
- <object class="GtkAction" id="add_to_group_action">
+ <object class="GtkAction" id="add-to-group">
<property name="label" translatable="yes">Add to _Groupâ</property>
<signal name="activate" handler="_on_gtk_action_activated" swapped="no"/>
</object>
- <object class="GtkAction" id="add_to_new_set_action">
+ <object class="GtkAction" id="add-to-new-set">
<property name="label" translatable="yes">_Create New Setâ</property>
<signal name="activate" handler="_on_gtk_action_activated" swapped="no"/>
</object>
- <object class="GtkAction" id="add_to_set_action">
+ <object class="GtkAction" id="add-to-set">
<property name="label" translatable="yes">Add to _Existing Setâ</property>
<signal name="activate" handler="_on_gtk_action_activated" swapped="no"/>
</object>
- <object class="GtkAction" id="edit_details_action">
+ <object class="GtkAction" id="edit-details">
<property name="label" translatable="yes">Edit _Detailsâ</property>
<signal name="activate" handler="_on_gtk_action_activated" swapped="no"/>
</object>
- <object class="GtkAction" id="open_in_external_viewer_action">
+ <object class="GtkAction" id="open-in-external-viewer">
<property name="label" translatable="yes">Open in E_xternal Viewer</property>
<signal name="activate" handler="_on_gtk_action_activated" swapped="no"/>
</object>
- <object class="GtkAction" id="remove_pictures_action">
+ <object class="GtkAction" id="remove-pictures">
<property name="label" translatable="yes">_Remove Pictures</property>
<property name="stock_id">gtk-remove</property>
<signal name="activate" handler="_on_gtk_action_activated" swapped="no"/>
</object>
- <object class="GtkAction" id="upload_pictures_action">
+ <object class="GtkAction" id="upload-all">
<property name="label" translatable="yes">_Upload All</property>
<property name="stock_id">gtk-go-up</property>
<signal name="activate" handler="_on_gtk_action_activated" swapped="no"/>
@@ -62,7 +62,7 @@
<object class="GtkMenuItem" id="edit_details_ctxt_menu_item">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="related_action">edit_details_action</property>
+ <property name="related_action">edit-details</property>
<property name="use_underline">True</property>
</object>
</child>
@@ -70,7 +70,7 @@
<object class="GtkMenuItem" id="add_tags_ctxt_menu_item">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="related_action">add_tags_action</property>
+ <property name="related_action">add-tags</property>
<property name="label" translatable="yes">Add _Tagsâ</property>
<property name="use_underline">True</property>
</object>
@@ -79,7 +79,7 @@
<object class="GtkMenuItem" id="add_to_group_ctxt_menu_item">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="related_action">add_to_group_action</property>
+ <property name="related_action">add-to-group</property>
<property name="use_action_appearance">False</property>
<property name="label" translatable="yes">Add to _Groupâ</property>
<property name="use_underline">True</property>
@@ -100,7 +100,7 @@
<object class="GtkMenuItem" id="create_new_set_ctxt_menu_item">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="related_action">add_to_new_set_action</property>
+ <property name="related_action">add-to-new-set</property>
<property name="label" translatable="yes">_Create New Setâ</property>
<property name="use_underline">True</property>
</object>
@@ -109,7 +109,7 @@
<object class="GtkMenuItem" id="add_to_existing_set_ctxt_menu_item">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="related_action">add_to_set_action</property>
+ <property name="related_action">add-to-set</property>
</object>
</child>
</object>
@@ -127,7 +127,7 @@
<object class="GtkMenuItem" id="open_in_external_viewer_ctxt_menu_item">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="related_action">open_in_external_viewer_action</property>
+ <property name="related_action">open-in-external-viewer</property>
</object>
</child>
<child>
@@ -141,7 +141,7 @@
<object class="GtkMenuItem" id="remove_pictures_ctxt_menu_item">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="related_action">remove_pictures_action</property>
+ <property name="related_action">remove-pictures</property>
</object>
</child>
</object>
@@ -156,7 +156,7 @@
<object class="GtkToolButton" id="open_project_button">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="related_action">open_project_action</property>
+ <property name="related_action">open-project</property>
<property name="label" translatable="yes">Open Project</property>
<property name="use_underline">True</property>
</object>
@@ -169,7 +169,7 @@
<object class="GtkToolButton" id="save_project_button">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="related_action">save_project_action</property>
+ <property name="related_action">save-project</property>
<property name="label" translatable="yes">Save Project</property>
<property name="use_underline">True</property>
</object>
@@ -182,7 +182,7 @@
<object class="GtkToolButton" id="save_project_as_button">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="related_action">save_project_as_action</property>
+ <property name="related_action">save-project-as</property>
<property name="label" translatable="yes">Save Project Asâ</property>
<property name="use_underline">True</property>
</object>
@@ -202,7 +202,7 @@
<object class="GtkToolButton" id="add_button">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="related_action">load_pictures_action</property>
+ <property name="related_action">load-pictures</property>
<property name="label" translatable="yes">Add</property>
<property name="use_underline">True</property>
</object>
@@ -215,7 +215,7 @@
<object class="GtkToolButton" id="remove_button">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="related_action">remove_pictures_action</property>
+ <property name="related_action">remove-pictures</property>
<property name="label" translatable="yes">Remove</property>
<property name="use_underline">True</property>
</object>
@@ -235,7 +235,7 @@
<object class="GtkToolButton" id="upload_button">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="related_action">upload_pictures_action</property>
+ <property name="related_action">upload-all</property>
<property name="label" translatable="yes">Upload</property>
<property name="use_underline">True</property>
</object>
diff --git a/src/frogr-main-view.c b/src/frogr-main-view.c
index f62c094..45597d8 100644
--- a/src/frogr-main-view.c
+++ b/src/frogr-main-view.c
@@ -415,30 +415,29 @@ _initialize_ui (FrogrMainView *self)
/* Get actions from GtkBuilder for the toolbar and the context menu */
priv->open_project_action =
- GTK_ACTION (gtk_builder_get_object (builder, "open_project_action"));
+ GTK_ACTION (gtk_builder_get_object (builder, "open-project"));
priv->save_project_action =
- GTK_ACTION (gtk_builder_get_object (builder, "save_project_action"));
+ GTK_ACTION (gtk_builder_get_object (builder, "save-project"));
priv->save_project_as_action =
- GTK_ACTION (gtk_builder_get_object (builder, "save_project_as_action"));
+ GTK_ACTION (gtk_builder_get_object (builder, "save-project-as"));
priv->load_pictures_action =
- GTK_ACTION (gtk_builder_get_object (builder, "load_pictures_action"));
+ GTK_ACTION (gtk_builder_get_object (builder, "load-pictures"));
priv->remove_pictures_action =
- GTK_ACTION (gtk_builder_get_object (builder, "remove_pictures_action"));
+ GTK_ACTION (gtk_builder_get_object (builder, "remove-pictures"));
priv->upload_pictures_action =
- GTK_ACTION (gtk_builder_get_object (builder, "upload_pictures_action"));
+ GTK_ACTION (gtk_builder_get_object (builder, "upload_all"));
priv->open_in_external_viewer_action =
- GTK_ACTION (gtk_builder_get_object (builder,
- "open_in_external_viewer_action"));
+ GTK_ACTION (gtk_builder_get_object (builder, "open-in-external-viewer"));
priv->add_tags_action =
- GTK_ACTION (gtk_builder_get_object (builder, "add_tags_action"));
+ GTK_ACTION (gtk_builder_get_object (builder, "add-tags"));
priv->edit_details_action =
- GTK_ACTION (gtk_builder_get_object (builder, "edit_details_action"));
+ GTK_ACTION (gtk_builder_get_object (builder, "edit-details"));
priv->add_to_group_action =
- GTK_ACTION (gtk_builder_get_object (builder, "add_to_group_action"));
+ GTK_ACTION (gtk_builder_get_object (builder, "add-to-group"));
priv->add_to_set_action =
- GTK_ACTION (gtk_builder_get_object (builder, "add_to_set_action"));
+ GTK_ACTION (gtk_builder_get_object (builder, "add-to-set"));
priv->add_to_new_set_action =
- GTK_ACTION (gtk_builder_get_object (builder, "add_to_new_set_action"));
+ GTK_ACTION (gtk_builder_get_object (builder, "add-to-new-set"));
/* Init main model's state description */
_update_state_description (self);
@@ -841,32 +840,32 @@ void
_on_gtk_action_activated (GtkAction *action, gpointer data)
{
FrogrMainView *mainview = FROGR_MAIN_VIEW (data);
- FrogrMainViewPrivate *priv = NULL;
+ const gchar *action_name = NULL;
- priv = FROGR_MAIN_VIEW_GET_PRIVATE (data);
- if (action == priv->upload_pictures_action)
+ action_name = gtk_action_get_name (action);
+ if (!g_strcmp0 (action_name, ACTION_UPLOAD_ALL))
_upload_pictures (mainview);
- else if (action == priv->edit_details_action)
+ else if (!g_strcmp0 (action_name, ACTION_EDIT_DETAILS))
_edit_selected_pictures (mainview);
- else if (action == priv->add_tags_action)
+ else if (!g_strcmp0 (action_name, ACTION_ADD_TAGS))
_add_tags_to_pictures (mainview);
- else if (action == priv->add_to_group_action)
+ else if (!g_strcmp0 (action_name, ACTION_ADD_TO_GROUP))
_add_pictures_to_group (mainview);
- else if (action == priv->add_to_set_action)
+ else if (!g_strcmp0 (action_name, ACTION_ADD_TO_SET))
_add_pictures_to_existing_set (mainview);
- else if (action == priv->add_to_new_set_action)
+ else if (!g_strcmp0 (action_name, ACTION_ADD_TO_NEW_SET))
_add_pictures_to_new_set (mainview);
- else if (action == priv->open_in_external_viewer_action)
+ else if (!g_strcmp0 (action_name, ACTION_OPEN_IN_EXTERNAL_VIEWER))
_open_pictures_in_external_viewer (mainview);
- else if (action == priv->load_pictures_action)
+ else if (!g_strcmp0 (action_name, ACTION_LOAD_PICTURES))
_load_pictures_dialog (mainview);
- else if (action == priv->remove_pictures_action)
+ else if (!g_strcmp0 (action_name, ACTION_REMOVE_PICTURES))
_remove_selected_pictures (mainview);
- else if (action == priv->open_project_action)
+ else if (!g_strcmp0 (action_name, ACTION_OPEN_PROJECT))
_open_project_dialog (mainview);
- else if (action == priv->save_project_action)
+ else if (!g_strcmp0 (action_name, ACTION_SAVE_PROJECT))
_save_current_project (mainview);
- else if (action == priv->save_project_as_action)
+ else if (!g_strcmp0 (action_name, ACTION_SAVE_PROJECT_AS))
_save_project_as_dialog (mainview);
else
g_assert_not_reached ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]