[gnome-screenshot/wip/exalm/libhandy: 3/3] dialog: Use HdyApplicationWindow




commit c6d4f8ea54ee9b371102d9d91c8db1e05d202f62
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Fri Jul 31 16:13:37 2020 +0500

    dialog: Use HdyApplicationWindow

 data/ui/screenshot-dialog.ui | 190 ++++++++++++++++++++++---------------------
 src/screenshot-dialog.c      |   4 +-
 src/screenshot-dialog.h      |   5 +-
 3 files changed, 103 insertions(+), 96 deletions(-)
---
diff --git a/data/ui/screenshot-dialog.ui b/data/ui/screenshot-dialog.ui
index 9f69f5a..1791aa9 100644
--- a/data/ui/screenshot-dialog.ui
+++ b/data/ui/screenshot-dialog.ui
@@ -2,127 +2,133 @@
 <!-- Generated with glade 3.22.0 -->
 <interface>
   <requires lib="gtk+" version="3.22"/>
-  <template class="ScreenshotDialog" parent="GtkApplicationWindow">
+  <template class="ScreenshotDialog" parent="HdyApplicationWindow">
     <property name="window_position">center</property>
     <signal name="key-press-event" handler="key_press_cb"/>
-    <child type="titlebar">
-      <object class="GtkHeaderBar">
-        <property name="visible">True</property>
-        <child>
-          <object class="GtkButton" id="back_button">
-            <property name="label" translatable="yes">_Cancel</property>
-            <property name="visible">True</property>
-            <property name="receives_default">True</property>
-            <property name="use_underline">True</property>
-            <signal name="clicked" handler="back_clicked_cb"/>
-          </object>
-        </child>
-        <child>
-          <object class="GtkButton" id="save_button">
-            <property name="label" translatable="yes">_Save</property>
-            <property name="visible">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>
-            <signal name="clicked" handler="save_clicked_cb"/>
-            <style>
-              <class name="suggested-action"/>
-            </style>
-          </object>
-          <packing>
-            <property name="pack_type">end</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="receives_default">True</property>
-            <property name="use_underline">True</property>
-            <signal name="clicked" handler="copy_clicked_cb"/>
-          </object>
-          <packing>
-            <property name="pack_type">end</property>
-          </packing>
-        </child>
-      </object>
-    </child>
     <child>
       <object class="GtkBox">
         <property name="visible">True</property>
-        <property name="halign">fill</property>
-        <property name="valign">fill</property>
-        <property name="expand">True</property>
-        <property name="margin">24</property>
         <property name="orientation">vertical</property>
-        <property name="spacing">24</property>
-        <child>
-           <object class="GtkDrawingArea" id="preview_darea">
-            <property name="visible">True</property>
-            <property name="width-request">256</property>
-            <property name="height-request">256</property>
-            <property name="expand">True</property>
-            <signal name="draw" handler="preview_draw_cb"/>
-            <signal name="button-press-event" handler="preview_button_press_event_cb"/>
-            <signal name="button-release-event" handler="preview_button_release_event_cb"/>
-            <signal name="drag-begin" handler="drag_begin_cb"/>
-            <signal name="drag-data-get" handler="drag_data_get_cb"/>
-          </object>
-        </child>
         <child>
-          <object class="GtkGrid">
+          <object class="HdyHeaderBar">
             <property name="visible">True</property>
-            <property name="halign">center</property>
-            <property name="row_spacing">6</property>
-            <property name="column_spacing">12</property>
             <child>
-              <object class="GtkLabel">
+              <object class="GtkButton" id="back_button">
+                <property name="label" translatable="yes">_Cancel</property>
                 <property name="visible">True</property>
-                <property name="halign">end</property>
-                <property name="label" translatable="yes">_Name:</property>
+                <property name="receives_default">True</property>
                 <property name="use_underline">True</property>
-                <property name="mnemonic_widget">filename_entry</property>
+                <signal name="clicked" handler="back_clicked_cb"/>
               </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">0</property>
-              </packing>
             </child>
             <child>
-              <object class="GtkEntry" id="filename_entry">
+              <object class="GtkButton" id="save_button">
+                <property name="label" translatable="yes">_Save</property>
                 <property name="visible">True</property>
-                <property name="width_chars">35</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>
+                <signal name="clicked" handler="save_clicked_cb"/>
+                <style>
+                  <class name="suggested-action"/>
+                </style>
               </object>
               <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">0</property>
+                <property name="pack_type">end</property>
               </packing>
             </child>
             <child>
-              <object class="GtkLabel">
+              <object class="GtkButton" id="copy_button">
+                <property name="label" translatable="yes">C_opy to Clipboard</property>
                 <property name="visible">True</property>
-                <property name="halign">end</property>
-                <property name="label" translatable="yes">_Folder:</property>
+                <property name="receives_default">True</property>
                 <property name="use_underline">True</property>
-                <property name="mnemonic_widget">save_widget</property>
+                <signal name="clicked" handler="copy_clicked_cb"/>
               </object>
               <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">1</property>
+                <property name="pack_type">end</property>
               </packing>
             </child>
+          </object>
+        </child>
+        <child>
+          <object class="GtkBox">
+            <property name="visible">True</property>
+            <property name="halign">fill</property>
+            <property name="valign">fill</property>
+            <property name="expand">True</property>
+            <property name="margin">24</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">24</property>
             <child>
-              <object class="GtkFileChooserButton" id="save_widget">
+               <object class="GtkDrawingArea" id="preview_darea">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="action">select-folder</property>
-                <property name="local_only">False</property>
+                <property name="width-request">256</property>
+                <property name="height-request">256</property>
+                <property name="expand">True</property>
+                <signal name="draw" handler="preview_draw_cb"/>
+                <signal name="button-press-event" handler="preview_button_press_event_cb"/>
+                <signal name="button-release-event" handler="preview_button_release_event_cb"/>
+                <signal name="drag-begin" handler="drag_begin_cb"/>
+                <signal name="drag-data-get" handler="drag_data_get_cb"/>
+              </object>
+            </child>
+            <child>
+              <object class="GtkGrid">
+                <property name="visible">True</property>
+                <property name="halign">center</property>
+                <property name="row_spacing">6</property>
+                <property name="column_spacing">12</property>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="halign">end</property>
+                    <property name="label" translatable="yes">_Name:</property>
+                    <property name="use_underline">True</property>
+                    <property name="mnemonic_widget">filename_entry</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkEntry" id="filename_entry">
+                    <property name="visible">True</property>
+                    <property name="width_chars">35</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="halign">end</property>
+                    <property name="label" translatable="yes">_Folder:</property>
+                    <property name="use_underline">True</property>
+                    <property name="mnemonic_widget">save_widget</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkFileChooserButton" id="save_widget">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="action">select-folder</property>
+                    <property name="local_only">False</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">1</property>
+                  </packing>
+                </child>
               </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">1</property>
-              </packing>
             </child>
           </object>
         </child>
diff --git a/src/screenshot-dialog.c b/src/screenshot-dialog.c
index 51de41f..43714b3 100644
--- a/src/screenshot-dialog.c
+++ b/src/screenshot-dialog.c
@@ -29,7 +29,7 @@
 
 struct _ScreenshotDialog
 {
-  GtkApplicationWindow parent_instance;
+  HdyApplicationWindow parent_instance;
 
   GdkPixbuf *screenshot;
   GdkPixbuf *preview_image;
@@ -42,7 +42,7 @@ struct _ScreenshotDialog
   gint drag_y;
 };
 
-G_DEFINE_TYPE (ScreenshotDialog, screenshot_dialog, GTK_TYPE_APPLICATION_WINDOW)
+G_DEFINE_TYPE (ScreenshotDialog, screenshot_dialog, HDY_TYPE_APPLICATION_WINDOW)
 
 enum {
   SIGNAL_SAVE,
diff --git a/src/screenshot-dialog.h b/src/screenshot-dialog.h
index 7419154..9c1a903 100644
--- a/src/screenshot-dialog.h
+++ b/src/screenshot-dialog.h
@@ -19,13 +19,14 @@
 
 #pragma once
 
-#include <gtk/gtk.h>
+#define HANDY_USE_UNSTABLE_API
+#include <handy.h>
 
 G_BEGIN_DECLS
 
 #define SCREENSHOT_TYPE_DIALOG (screenshot_dialog_get_type())
 
-G_DECLARE_FINAL_TYPE (ScreenshotDialog, screenshot_dialog, SCREENSHOT, DIALOG, GtkApplicationWindow)
+G_DECLARE_FINAL_TYPE (ScreenshotDialog, screenshot_dialog, SCREENSHOT, DIALOG, HdyApplicationWindow)
 
 ScreenshotDialog *screenshot_dialog_new          (GtkApplication *app,
                                                   GdkPixbuf      *screenshot,


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