[file-roller] request-dialog: Use gtk-dialogs-use-header GtkSetting
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [file-roller] request-dialog: Use gtk-dialogs-use-header GtkSetting
- Date: Sun, 15 Feb 2015 12:00:10 +0000 (UTC)
commit b8fe8755e8c102a87a3da17ac211699c579f2d59
Author: Iain Lane <iain orangesquash org uk>
Date: Fri Dec 19 17:40:43 2014 +0000
request-dialog: Use gtk-dialogs-use-header GtkSetting
https://bugzilla.gnome.org/show_bug.cgi?id=741925
src/gtk-utils.c | 21 ++++++++--
src/ui/request-dialog.ui | 94 +++++++++++++--------------------------------
2 files changed, 44 insertions(+), 71 deletions(-)
---
diff --git a/src/gtk-utils.c b/src/gtk-utils.c
index a1aa90e..78a5d2a 100644
--- a/src/gtk-utils.c
+++ b/src/gtk-utils.c
@@ -127,16 +127,29 @@ _gtk_request_dialog_run (GtkWindow *parent,
GtkWidget *dialog;
GtkWidget *label;
GtkWidget *entry;
+ GtkWidget *content_area;
+ GtkWidget *request_box;
char *result;
+ gboolean use_header;
+
+ g_object_get (gtk_settings_get_default (),
+ "gtk-dialogs-use-header", &use_header,
+ NULL);
builder = _gtk_builder_new_from_resource ("request-dialog.ui");
- dialog = _gtk_builder_get_widget (builder, "request_dialog");
+ request_box = _gtk_builder_get_widget (builder, "request_box");
+
+ dialog = g_object_new (GTK_TYPE_DIALOG,
+ "transient-for", parent,
+ "modal", flags & GTK_DIALOG_MODAL,
+ "use-header-bar", use_header,
+ NULL);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
- gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
- gtk_window_set_modal (GTK_WINDOW (dialog), (flags & GTK_DIALOG_MODAL));
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), (flags & GTK_DIALOG_DESTROY_WITH_PARENT));
gtk_window_set_title (GTK_WINDOW (dialog), title);
- g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) g_object_unref, builder);
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
+ gtk_container_add (GTK_CONTAINER (content_area), request_box);
+ g_object_weak_ref (G_OBJECT (request_box), (GWeakNotify) g_object_unref, builder);
if (flags & GTK_DIALOG_MODAL)
_gtk_dialog_add_to_window_group (GTK_DIALOG (dialog));
diff --git a/src/ui/request-dialog.ui b/src/ui/request-dialog.ui
index 72e6b2f..52727c7 100644
--- a/src/ui/request-dialog.ui
+++ b/src/ui/request-dialog.ui
@@ -1,80 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
- <object class="GtkDialog" id="request_dialog">
- <property name="width_request">500</property>
- <property name="can_focus">False</property>
- <property name="border_width">5</property>
- <property name="resizable">False</property>
- <property name="type_hint">dialog</property>
- <property name="use_header_bar">1</property>
- <child internal-child="vbox">
- <object class="GtkBox" id="dialog-vbox3">
+ <object class="GtkHBox" id="request_box">
+ <property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <property name="spacing">2</property>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="dialog-action_area3">
- <property name="can_focus">False</property>
- <property name="layout_style">end</property>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
+ <property name="border_width">5</property>
+ <property name="spacing">12</property>
<child>
- <object class="GtkHBox" id="hbox28">
+ <object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="border_width">5</property>
- <property name="spacing">12</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">4</property>
<child>
- <object class="GtkBox" id="box1">
+ <object class="GtkLabel" id="message_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <property name="spacing">4</property>
- <child>
- <object class="GtkLabel" id="message_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">value_entry</property>
- <property name="ellipsize">end</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="value_entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- <property name="activates_default">True</property>
- <property name="width_chars">50</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
+ <property name="xalign">0</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">value_entry</property>
+ <property name="ellipsize">end</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="value_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="activates_default">True</property>
+ <property name="width_chars">50</property>
</object>
<packing>
- <property name="expand">True</property>
+ <property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
@@ -87,6 +49,4 @@
</packing>
</child>
</object>
- </child>
- </object>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]