summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Mikhaylenko <alexm@gnome.org>2020-07-31 16:10:56 +0500
committerAlexander Mikhaylenko <alexm@gnome.org>2020-08-01 14:37:20 +0500
commit5e136b9f9cfeca2d67a76086cadbbbd675d07ef4 (patch)
treeb044a8108abe88145d9cb9c434261cf0813cd743
parentf5009d099da6f92b5aa292ba80f495ee824c5783 (diff)
downloadgnome-screenshot-5e136b9f9cfeca2d67a76086cadbbbd675d07ef4.tar.gz
interactive-dialog: Port to libhandy
-rw-r--r--data/ui/screenshot-interactive-dialog.ui308
-rw-r--r--src/screenshot-interactive-dialog.c31
-rw-r--r--src/screenshot-interactive-dialog.h5
3 files changed, 146 insertions, 198 deletions
diff --git a/data/ui/screenshot-interactive-dialog.ui b/data/ui/screenshot-interactive-dialog.ui
index 4b22d98..b5fa234 100644
--- a/data/ui/screenshot-interactive-dialog.ui
+++ b/data/ui/screenshot-interactive-dialog.ui
@@ -2,127 +2,170 @@
<!-- Generated with glade 3.22.0 -->
<interface>
<requires lib="gtk+" version="3.20"/>
- <template class="ScreenshotInteractiveDialog" parent="GtkApplicationWindow">
+ <template class="ScreenshotInteractiveDialog" parent="HdyApplicationWindow">
<property name="resizable">False</property>
<property name="window-position">center</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="halign">center</property>
- <property name="valign">center</property>
<property name="orientation">vertical</property>
- <property name="spacing">24</property>
- <property name="margin">24</property>
<child>
- <object class="GtkBox">
+ <object class="HdyHeaderBar">
<property name="visible">True</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
+ <property name="show_close_button">True</property>
+ <child>
+ <object class="GtkButton" id="capture_button">
+ <property name="label" translatable="yes">_Take Screenshot</property>
+ <property name="visible">True</property>
+ <property name="receives_default">True</property>
+ <property name="action_name">app.screen-shot</property>
+ <property name="use_underline">True</property>
+ <property name="can-default">True</property>
+ <signal name="clicked" handler="capture_button_clicked_cb"/>
+ <style>
+ <class name="suggested-action"/>
+ </style>
+ </object>
+ </child>
<child>
- <object class="GtkLabel">
+ <object class="GtkMenuButton" id="menu">
<property name="visible">True</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes">Capture Area</property>
+ <property name="receives_default">True</property>
+ <property name="menu-model">primary_menu</property>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="icon_name">open-menu-symbolic</property>
+ </object>
+ </child>
</object>
+ <packing>
+ <property name="pack_type">end</property>
+ </packing>
</child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <property name="spacing">24</property>
+ <property name="margin">24</property>
+ <property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
- <property name="homogeneous">True</property>
- <style>
- <class name="linked"/>
- </style>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkRadioButton" id="screen">
+ <object class="GtkLabel">
<property name="visible">True</property>
- <property name="receives_default">True</property>
- <property name="draw_indicator">False</property>
- <property name="group">selection</property>
- <signal name="toggled" handler="screen_toggled_cb"/>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="margin">12</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkImage" id="screen_img">
- <property name="visible">True</property>
- <property name="icon_name">display-symbolic</property>
- <property name="pixel_size">32</property>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Screen</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">screen</property>
- </object>
- </child>
- </object>
- </child>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Capture Area</property>
</object>
</child>
<child>
- <object class="GtkRadioButton" id="window">
+ <object class="GtkBox">
<property name="visible">True</property>
- <property name="receives_default">True</property>
- <property name="active">True</property>
- <property name="draw_indicator">False</property>
- <property name="group">screen</property>
- <signal name="toggled" handler="window_toggled_cb"/>
+ <property name="homogeneous">True</property>
+ <style>
+ <class name="linked"/>
+ </style>
<child>
- <object class="GtkBox">
+ <object class="GtkRadioButton" id="screen">
<property name="visible">True</property>
- <property name="margin">12</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkImage" id="window_img">
- <property name="visible">True</property>
- <property name="icon_name">window-symbolic</property>
- <property name="pixel_size">32</property>
- </object>
- </child>
+ <property name="receives_default">True</property>
+ <property name="draw_indicator">False</property>
+ <property name="group">selection</property>
+ <signal name="toggled" handler="screen_toggled_cb"/>
<child>
- <object class="GtkLabel">
+ <object class="GtkBox">
<property name="visible">True</property>
- <property name="label" translatable="yes">_Window</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">window</property>
+ <property name="margin">12</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkImage" id="screen_img">
+ <property name="visible">True</property>
+ <property name="icon_name">display-symbolic</property>
+ <property name="pixel_size">32</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Screen</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">screen</property>
+ </object>
+ </child>
</object>
</child>
</object>
</child>
- </object>
- </child>
- <child>
- <object class="GtkRadioButton" id="selection">
- <property name="visible">True</property>
- <property name="receives_default">True</property>
- <property name="draw_indicator">False</property>
- <property name="group">screen</property>
- <signal name="toggled" handler="selection_toggled_cb"/>
<child>
- <object class="GtkBox">
+ <object class="GtkRadioButton" id="window">
<property name="visible">True</property>
- <property name="margin">12</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
+ <property name="receives_default">True</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">False</property>
+ <property name="group">screen</property>
+ <signal name="toggled" handler="window_toggled_cb"/>
<child>
- <object class="GtkImage" id="selection_img">
+ <object class="GtkBox">
<property name="visible">True</property>
- <property name="icon_name">selection-symbolic</property>
- <property name="pixel_size">32</property>
+ <property name="margin">12</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkImage" id="window_img">
+ <property name="visible">True</property>
+ <property name="icon_name">window-symbolic</property>
+ <property name="pixel_size">32</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Window</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">window</property>
+ </object>
+ </child>
</object>
</child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="selection">
+ <property name="visible">True</property>
+ <property name="receives_default">True</property>
+ <property name="draw_indicator">False</property>
+ <property name="group">screen</property>
+ <signal name="toggled" handler="selection_toggled_cb"/>
<child>
- <object class="GtkLabel">
+ <object class="GtkBox">
<property name="visible">True</property>
- <property name="label" translatable="yes">Se_lection</property>
- <property name="use_underline">True</property>
+ <property name="margin">12</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkImage" id="selection_img">
+ <property name="visible">True</property>
+ <property name="icon_name">selection-symbolic</property>
+ <property name="pixel_size">32</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Se_lection</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
</object>
</child>
</object>
@@ -131,68 +174,34 @@
</child>
</object>
</child>
- </object>
- </child>
- <child>
- <object class="GtkListBox" id="listbox">
- <property name="visible">True</property>
- <property name="selection_mode">none</property>
- <property name="activate_on_single_click">False</property>
- <property name="width_request">360</property>
- <style>
- <class name="frame"/>
- </style>
<child>
- <object class="GtkListBoxRow" id="pointer_row">
+ <object class="GtkListBox" id="listbox">
<property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="selection_mode">none</property>
+ <property name="width_request">360</property>
+ <style>
+ <class name="content"/>
+ </style>
<child>
- <object class="GtkBox">
+ <object class="HdyActionRow" id="pointer_row">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin">12</property>
- <property name="spacing">10</property>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="halign">start</property>
- <property name="hexpand">True</property>
- <property name="label" translatable="yes">Show _Pointer</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">pointer</property>
- </object>
- </child>
+ <property name="title" translatable="yes">Show _Pointer</property>
+ <property name="use_underline">True</property>
+ <property name="activatable-widget">pointer</property>
<child>
<object class="GtkSwitch" id="pointer">
<property name="visible">True</property>
+ <property name="valign">center</property>
<signal name="state-set" handler="include_pointer_toggled_cb"/>
</object>
</child>
</object>
</child>
- </object>
- </child>
- <child>
- <object class="GtkListBoxRow" id="delayrow">
- <property name="visible">True</property>
<child>
- <object class="GtkBox">
+ <object class="HdyActionRow">
<property name="visible">True</property>
- <property name="margin-top">9</property>
- <property name="margin-bottom">9</property>
- <property name="margin-start">12</property>
- <property name="margin-end">12</property>
- <property name="spacing">10</property>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="halign">start</property>
- <property name="hexpand">True</property>
- <property name="label" translatable="yes">_Delay in Seconds</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">delay</property>
- </object>
- </child>
+ <property name="title" translatable="yes">_Delay in Seconds</property>
+ <property name="use_underline">True</property>
<child>
<object class="GtkSpinButton" id="delay">
<property name="visible">True</property>
@@ -202,6 +211,7 @@
<property name="climb_rate">1</property>
<property name="snap_to_ticks">True</property>
<property name="numeric">True</property>
+ <property name="valign">center</property>
<signal name= "value-changed" handler="delay_spin_value_changed_cb"/>
</object>
</child>
@@ -213,42 +223,6 @@
</child>
</object>
</child>
- <child type="titlebar">
- <object class="GtkHeaderBar">
- <property name="visible">True</property>
- <property name="show_close_button">True</property>
- <child>
- <object class="GtkButton" id="capture_button">
- <property name="label" translatable="yes">_Take Screenshot</property>
- <property name="visible">True</property>
- <property name="receives_default">True</property>
- <property name="action_name">app.screen-shot</property>
- <property name="use_underline">True</property>
- <property name="can-default">True</property>
- <signal name="clicked" handler="capture_button_clicked_cb"/>
- <style>
- <class name="suggested-action"/>
- </style>
- </object>
- </child>
- <child>
- <object class="GtkMenuButton" id="menu">
- <property name="visible">True</property>
- <property name="receives_default">True</property>
- <property name="menu-model">primary_menu</property>
- <child>
- <object class="GtkImage">
- <property name="visible">True</property>
- <property name="icon_name">open-menu-symbolic</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="pack_type">end</property>
- </packing>
- </child>
- </object>
- </child>
</template>
<object class="GtkAdjustment" id="delay_adjustment">
<property name="lower">0</property>
diff --git a/src/screenshot-interactive-dialog.c b/src/screenshot-interactive-dialog.c
index ab866b3..a7b15ba 100644
--- a/src/screenshot-interactive-dialog.c
+++ b/src/screenshot-interactive-dialog.c
@@ -36,7 +36,7 @@ typedef enum {
struct _ScreenshotInteractiveDialog
{
- GtkApplicationWindow parent_instance;
+ HdyApplicationWindow parent_instance;
GtkWidget *listbox;
GtkWidget *pointer;
@@ -46,7 +46,7 @@ struct _ScreenshotInteractiveDialog
GtkWidget *selection;
};
-G_DEFINE_TYPE (ScreenshotInteractiveDialog, screenshot_interactive_dialog, GTK_TYPE_APPLICATION_WINDOW)
+G_DEFINE_TYPE (ScreenshotInteractiveDialog, screenshot_interactive_dialog, HDY_TYPE_APPLICATION_WINDOW)
enum {
SIGNAL_CAPTURE,
@@ -115,28 +115,6 @@ capture_button_clicked_cb (GtkButton *button,
}
static void
-header_func (GtkListBoxRow *row,
- GtkListBoxRow *before,
- ScreenshotInteractiveDialog *self)
-{
- GtkWidget *current;
-
- if (before == NULL)
- {
- gtk_list_box_row_set_header (row, NULL);
- return;
- }
-
- current = gtk_list_box_row_get_header (row);
- if (current == NULL)
- {
- current = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_widget_show (current);
- gtk_list_box_row_set_header (row, current);
- }
-}
-
-static void
screenshot_interactive_dialog_class_init (ScreenshotInteractiveDialogClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
@@ -171,11 +149,6 @@ screenshot_interactive_dialog_init (ScreenshotInteractiveDialog *self)
{
gtk_widget_init_template (GTK_WIDGET (self));
- gtk_list_box_set_header_func (GTK_LIST_BOX (self->listbox),
- (GtkListBoxUpdateHeaderFunc) header_func,
- self,
- NULL);
-
if (screenshot_config->take_window_shot)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->window), TRUE);
diff --git a/src/screenshot-interactive-dialog.h b/src/screenshot-interactive-dialog.h
index cd98c1d..e506b66 100644
--- a/src/screenshot-interactive-dialog.h
+++ b/src/screenshot-interactive-dialog.h
@@ -22,13 +22,14 @@
#pragma once
-#include <gtk/gtk.h>
+#define HANDY_USE_UNSTABLE_API
+#include <handy.h>
G_BEGIN_DECLS
#define SCREENSHOT_TYPE_INTERACTIVE_DIALOG (screenshot_interactive_dialog_get_type())
-G_DECLARE_FINAL_TYPE (ScreenshotInteractiveDialog, screenshot_interactive_dialog, SCREENSHOT, INTERACTIVE_DIALOG, GtkApplicationWindow)
+G_DECLARE_FINAL_TYPE (ScreenshotInteractiveDialog, screenshot_interactive_dialog, SCREENSHOT, INTERACTIVE_DIALOG, HdyApplicationWindow)
ScreenshotInteractiveDialog *screenshot_interactive_dialog_new (GtkApplication *app);