[frogr] Add a new 'Save Project As' button to the toolbar



commit f896cc7ecebda99cfa68c2a91b58c2f504b35015
Author: Mario Sanchez Prada <msanchez gnome org>
Date:   Fri Nov 23 19:46:55 2012 +0100

    Add a new 'Save Project As' button to the toolbar

 data/gtkbuilder/frogr-main-view.xml |   18 ++++++++++++++++++
 src/frogr-main-view.c               |    7 ++++++-
 2 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/data/gtkbuilder/frogr-main-view.xml b/data/gtkbuilder/frogr-main-view.xml
index 0d4d954..2b37d0b 100644
--- a/data/gtkbuilder/frogr-main-view.xml
+++ b/data/gtkbuilder/frogr-main-view.xml
@@ -11,6 +11,11 @@
     <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">
+    <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">
     <property name="label" translatable="yes">_Load Picturesâ</property>
     <property name="stock_id">gtk-add</property>
@@ -174,6 +179,19 @@
           </packing>
         </child>
         <child>
+          <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="label" translatable="yes">Save Project Asâ</property>
+            <property name="use_underline">True</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="homogeneous">True</property>
+          </packing>
+        </child>
+        <child>
           <object class="GtkSeparatorToolItem" id="separator10">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
diff --git a/src/frogr-main-view.c b/src/frogr-main-view.c
index 2d10b4d..75eb001 100644
--- a/src/frogr-main-view.c
+++ b/src/frogr-main-view.c
@@ -126,6 +126,7 @@ typedef struct _FrogrMainViewPrivate {
   /* For the toolbar and the contextual menu */
   GtkAction *open_project_action;
   GtkAction *save_project_action;
+  GtkAction *save_project_as_action;
   GtkAction *load_pictures_action;
   GtkAction *remove_pictures_action;
   GtkAction *upload_pictures_action;
@@ -417,6 +418,8 @@ _initialize_ui (FrogrMainView *self)
     GTK_ACTION (gtk_builder_get_object (builder, "open_project_action"));
   priv->save_project_action =
     GTK_ACTION (gtk_builder_get_object (builder, "save_project_action"));
+  priv->save_project_as_action =
+    GTK_ACTION (gtk_builder_get_object (builder, "save_project_as_action"));
   priv->load_pictures_action =
     GTK_ACTION (gtk_builder_get_object (builder, "load_pictures_action"));
   priv->remove_pictures_action =
@@ -863,6 +866,8 @@ _on_gtk_action_activated (GtkAction *action, gpointer data)
     _open_project_dialog (mainview);
   else if (action == priv->save_project_action)
     _save_current_project (mainview);
+  else if (action == priv->save_project_as_action)
+    _save_project_as_dialog (mainview);
   else
     g_assert_not_reached ();
 }
@@ -2117,7 +2122,7 @@ _update_sensitiveness (FrogrMainView *self)
     case FROGR_STATE_UPLOADING_PICTURES:
       _update_sensitiveness_for_action (self, ACTION_OPEN_PROJECT, priv->open_project_action, FALSE);
       _update_sensitiveness_for_action (self, ACTION_SAVE_PROJECT, priv->save_project_action, FALSE);
-      _update_sensitiveness_for_action (self, ACTION_SAVE_PROJECT_AS, NULL, FALSE);
+      _update_sensitiveness_for_action (self, ACTION_SAVE_PROJECT_AS, priv->save_project_as_action, FALSE);
       _update_sensitiveness_for_action (self, ACTION_LOAD_PICTURES, priv->load_pictures_action, FALSE);
       _update_sensitiveness_for_action (self, ACTION_REMOVE_PICTURES, priv->remove_pictures_action, FALSE);
       _update_sensitiveness_for_action (self, ACTION_UPLOAD_ALL, priv->upload_pictures_action, FALSE);



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