[gnome-screenshot] screenshot: port screenshot dialog to GtkHeaderBar



commit 136cc54517f53e925ab89593e05901e6f5df7e4f
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sun Feb 16 08:37:06 2014 -0800

    screenshot: port screenshot dialog to GtkHeaderBar

 src/screenshot-dialog.c  |    2 +
 src/screenshot-dialog.ui |   89 ++++++++++++++++++++++++---------------------
 2 files changed, 49 insertions(+), 42 deletions(-)
---
diff --git a/src/screenshot-dialog.c b/src/screenshot-dialog.c
index f3dc5d3..7d88492 100644
--- a/src/screenshot-dialog.c
+++ b/src/screenshot-dialog.c
@@ -212,6 +212,8 @@ screenshot_dialog_new (GdkPixbuf              *screenshot,
   g_signal_connect (dialog->save_button, "clicked", G_CALLBACK (button_clicked), dialog);
   dialog->copy_button = GTK_WIDGET (gtk_builder_get_object (ui, "copy_button"));
   g_signal_connect (dialog->copy_button, "clicked", G_CALLBACK (button_clicked), dialog);
+  dialog->copy_button = GTK_WIDGET (gtk_builder_get_object (ui, "cancel_button"));
+  g_signal_connect_swapped (dialog->copy_button, "clicked", G_CALLBACK (gtk_widget_destroy), dialog->dialog);
 
   g_object_unref (ui);
   g_free (current_folder);
diff --git a/src/screenshot-dialog.ui b/src/screenshot-dialog.ui
index e1babea..f935031 100644
--- a/src/screenshot-dialog.ui
+++ b/src/screenshot-dialog.ui
@@ -7,6 +7,53 @@
     <property name="title" translatable="yes">Save Screenshot</property>
     <property name="resizable">False</property>
     <property name="window_position">center</property>
+    <child type="titlebar">
+      <object class="GtkHeaderBar" id="headerbar1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <child>
+          <object class="GtkButton" id="cancel_button">
+            <property name="label" translatable="yes">_Cancel</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="use_underline">True</property>
+          </object>
+          <packing>
+            <property name="pack-type">start</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="copy_button">
+            <property name="label" translatable="yes">C_opy to Clipboard</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="use_underline">True</property>
+          </object>
+          <packing>
+            <property name="pack-type">start</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="save_button">
+            <property name="label" translatable="yes">_Save</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="can_default">True</property>
+            <property name="has_default">True</property>
+            <property name="receives_default">True</property>
+            <property name="use_underline">True</property>
+            <style>
+              <class name="suggested-action"/>
+            </style>
+          </object>
+          <packing>
+            <property name="pack-type">end</property>
+          </packing>
+        </child>
+      </object>
+    </child>
     <child>
       <object class="GtkGrid" id="grid1">
         <property name="visible">True</property>
@@ -94,48 +141,6 @@
           </packing>
         </child>
         <child>
-          <object class="GtkButtonBox" id="buttonbox1">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <child>
-              <object class="GtkButton" id="copy_button">
-                <property name="label" translatable="yes">C_opy to Clipboard</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_underline">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="save_button">
-                <property name="label">gtk-save</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="has_default">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_stock">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="left_attach">0</property>
-            <property name="top_attach">2</property>
-            <property name="width">3</property>
-            <property name="height">1</property>
-          </packing>
-        </child>
-        <child>
           <object class="GtkFileChooserButton" id="save_widget">
             <property name="visible">True</property>
             <property name="can_focus">False</property>


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