[goobox] extract dialog: use the headerbar
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goobox] extract dialog: use the headerbar
- Date: Sat, 29 Dec 2018 14:20:29 +0000 (UTC)
commit 5b2d76fc16d40e90988cae92015185f135c0edd1
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sat Dec 29 09:53:32 2018 +0100
extract dialog: use the headerbar
src/dlg-extract.c | 50 ++++++++++++++-----
src/ui/extract.ui | 143 +++++++++++++-----------------------------------------
2 files changed, 72 insertions(+), 121 deletions(-)
---
diff --git a/src/dlg-extract.c b/src/dlg-extract.c
index a3f531e..347d90b 100644
--- a/src/dlg-extract.c
+++ b/src/dlg-extract.c
@@ -56,8 +56,7 @@ dialog_destroy_cb (GtkWidget *widget,
static void
-ok_button_clicked_cb (GtkWidget *widget,
- DialogData *data)
+ok_button_clicked (DialogData *data)
{
GList *tracks_to_rip;
@@ -72,7 +71,24 @@ ok_button_clicked_cb (GtkWidget *widget,
dlg_ripper (data->window, tracks_to_rip);
track_list_free (tracks_to_rip);
- gtk_widget_destroy (data->dialog);
+}
+
+
+static void
+dialog_response_cb (GtkWidget *dialog,
+ int response_id,
+ DialogData *data)
+{
+ switch (response_id) {
+ case GTK_RESPONSE_OK:
+ ok_button_clicked (data);
+ gtk_widget_destroy (dialog);
+ break;
+
+ default:
+ gtk_widget_destroy (dialog);
+ break;
+ }
}
@@ -141,7 +157,23 @@ dlg_extract_ask (GooWindow *window)
/* Get the widgets. */
- data->dialog = GET_WIDGET ("extract_dialog");
+ data->dialog = g_object_new (GTK_TYPE_DIALOG,
+ "title", _("Extract Tracks"),
+ "transient-for", GTK_WINDOW (window),
+ "modal", TRUE,
+ "use-header-bar", _gtk_settings_get_dialogs_use_header (),
+ "resizable", FALSE,
+ NULL);
+ gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (data->dialog))),
+ GET_WIDGET ("extract_dialog"));
+ gtk_dialog_add_buttons (GTK_DIALOG (data->dialog),
+ _GTK_LABEL_CANCEL, GTK_RESPONSE_CANCEL,
+ _("_Extract"), GTK_RESPONSE_OK,
+ NULL);
+
+ gtk_dialog_set_default_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_OK);
+ gtk_style_context_add_class (gtk_widget_get_style_context (gtk_dialog_get_widget_for_response
(GTK_DIALOG (data->dialog), GTK_RESPONSE_OK)),
+ GTK_STYLE_CLASS_SUGGESTED_ACTION);
/* Set widgets data. */
@@ -158,13 +190,9 @@ dlg_extract_ask (GooWindow *window)
"destroy",
G_CALLBACK (dialog_destroy_cb),
data);
- g_signal_connect_swapped (GET_WIDGET ("cancel_button"),
- "clicked",
- G_CALLBACK (gtk_widget_destroy),
- G_OBJECT (data->dialog));
- g_signal_connect (GET_WIDGET ("ok_button"),
- "clicked",
- G_CALLBACK (ok_button_clicked_cb),
+ g_signal_connect (G_OBJECT (data->dialog),
+ "response",
+ G_CALLBACK (dialog_response_cb),
data);
/* run dialog. */
diff --git a/src/ui/extract.ui b/src/ui/extract.ui
index c33113a..f73fa67 100644
--- a/src/ui/extract.ui
+++ b/src/ui/extract.ui
@@ -1,134 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.1 -->
+<!-- Generated with glade 3.22.1 -->
<interface>
- <requires lib="gtk+" version="3.0"/>
- <object class="GtkDialog" id="extract_dialog">
- <property name="width_request">300</property>
+ <requires lib="gtk+" version="3.20"/>
+ <object class="GtkVBox" id="extract_dialog">
+ <property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="border_width">5</property>
- <property name="title" translatable="yes">Extract Tracks</property>
- <property name="resizable">False</property>
- <property name="window_position">center-on-parent</property>
- <property name="type_hint">dialog</property>
- <child internal-child="vbox">
- <object class="GtkBox" id="dialog-vbox2">
+ <property name="border_width">15</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkVBox" id="vbox11">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <property name="spacing">12</property>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="dialog-action_area2">
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkRadioButton" id="all_tracks_radiobutton">
+ <property name="label" translatable="yes">_All tracks</property>
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="cancel_button">
- <property name="label">gtk-cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="ok_button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- <child>
- <object class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">_Extract</property>
- <property name="use_underline">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
+ <property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkVBox" id="vbox3">
+ <object class="GtkRadioButton" id="selected_tracks_radiobutton">
+ <property name="label" translatable="yes">_Selected tracks</property>
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="border_width">5</property>
- <property name="spacing">12</property>
- <child>
- <object class="GtkVBox" id="vbox11">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkRadioButton" id="all_tracks_radiobutton">
- <property name="label" translatable="yes">_All tracks</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="xalign">0</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkRadioButton" id="selected_tracks_radiobutton">
- <property name="label" translatable="yes">_Selected tracks</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- <property name="group">all_tracks_radiobutton</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">all_tracks_radiobutton</property>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">True</property>
+ <property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
</child>
- <action-widgets>
- <action-widget response="-6">cancel_button</action-widget>
- <action-widget response="-5">ok_button</action-widget>
- </action-widgets>
</object>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]