[file-roller] use the header-bar for the progress dialog
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [file-roller] use the header-bar for the progress dialog
- Date: Sun, 15 Feb 2015 15:27:56 +0000 (UTC)
commit 16496e3d8d8d580acf15aeb23cf325632a8424db
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sun Feb 15 16:07:27 2015 +0100
use the header-bar for the progress dialog
src/fr-window.c | 36 +++++++++---
src/ui/progress-dialog.ui | 139 ++++++++++++++++----------------------------
2 files changed, 79 insertions(+), 96 deletions(-)
---
diff --git a/src/fr-window.c b/src/fr-window.c
index 1c5a323..d23cf11 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -2400,6 +2400,7 @@ create_the_progress_dialog (FrWindow *window)
GtkDialogFlags flags;
const char *title;
GtkBuilder *builder;
+ gboolean use_header_bar;
GtkWidget *dialog;
if (window->priv->progress_dialog != NULL)
@@ -2417,21 +2418,40 @@ create_the_progress_dialog (FrWindow *window)
}
builder = _gtk_builder_new_from_resource ("progress-dialog.ui");
- dialog = _gtk_builder_get_widget (builder, "progress_dialog");
+ use_header_bar = _gtk_settings_get_dialogs_use_header ();
+ dialog = g_object_new (GTK_TYPE_DIALOG, "use-header-bar", use_header_bar, NULL);
+ gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
+ _gtk_builder_get_widget (builder, "progress_dialog_content"));
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
gtk_window_set_title (GTK_WINDOW (dialog), title);
gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
gtk_window_set_modal (GTK_WINDOW (dialog), (flags & GTK_DIALOG_MODAL));
+ gtk_button_box_set_layout (GTK_BUTTON_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dialog))),
GTK_BUTTONBOX_EXPAND);
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), (flags & GTK_DIALOG_DESTROY_WITH_PARENT));
g_object_weak_ref (G_OBJECT (dialog), (GWeakNotify) g_object_unref, builder);
_gtk_dialog_add_to_window_group (GTK_DIALOG (dialog));
- window->priv->pd_quit_button = gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Quit"),
DIALOG_RESPONSE_QUIT);
- window->priv->pd_open_archive_button = gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Open the
Archive"), DIALOG_RESPONSE_OPEN_ARCHIVE);
- window->priv->pd_open_destination_button = gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Show the
Files"), DIALOG_RESPONSE_OPEN_DESTINATION_FOLDER);
- window->priv->pd_close_button = gtk_dialog_add_button (GTK_DIALOG (dialog), _GTK_LABEL_CLOSE,
GTK_RESPONSE_CLOSE);
- window->priv->pd_cancel_button = gtk_dialog_add_button (GTK_DIALOG (dialog), _GTK_LABEL_CANCEL,
GTK_RESPONSE_CANCEL);
+ gtk_dialog_add_buttons (GTK_DIALOG (dialog),
+ _GTK_LABEL_CLOSE, GTK_RESPONSE_CLOSE,
+ _GTK_LABEL_CANCEL, GTK_RESPONSE_CANCEL,
+ _("_Quit"), DIALOG_RESPONSE_QUIT,
+ _("_Open the Archive"), DIALOG_RESPONSE_OPEN_ARCHIVE,
+ _("_Show the Files"), DIALOG_RESPONSE_OPEN_DESTINATION_FOLDER,
+ NULL);
+
+ window->priv->pd_quit_button = gtk_dialog_get_widget_for_response (GTK_DIALOG (dialog),
DIALOG_RESPONSE_QUIT);
+ window->priv->pd_open_archive_button = gtk_dialog_get_widget_for_response (GTK_DIALOG (dialog),
DIALOG_RESPONSE_OPEN_ARCHIVE);
+ window->priv->pd_open_destination_button = gtk_dialog_get_widget_for_response (GTK_DIALOG (dialog),
DIALOG_RESPONSE_OPEN_DESTINATION_FOLDER);
+ window->priv->pd_close_button = gtk_dialog_get_widget_for_response (GTK_DIALOG (dialog),
GTK_RESPONSE_CLOSE);
+ window->priv->pd_cancel_button = gtk_dialog_get_widget_for_response (GTK_DIALOG (dialog),
GTK_RESPONSE_CANCEL);
+
+ if (use_header_bar) {
+ GtkWidget *header_bar = gtk_dialog_get_header_bar (GTK_DIALOG (dialog));
+ gtk_container_child_set (GTK_CONTAINER (header_bar), window->priv->pd_close_button,
"pack-type", GTK_PACK_START, NULL);
+ gtk_container_child_set (GTK_CONTAINER (header_bar), window->priv->pd_cancel_button,
"pack-type", GTK_PACK_START, NULL);
+ }
+
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
window->priv->progress_dialog = dialog;
@@ -5662,8 +5682,8 @@ fr_window_construct (FrWindow *window)
FALSE,
0);
gtk_widget_show_all (navigation_commands);
- gtk_style_context_add_class (gtk_widget_get_style_context (navigation_commands), "raised");
- gtk_style_context_add_class (gtk_widget_get_style_context (navigation_commands), "linked");
+ gtk_style_context_add_class (gtk_widget_get_style_context (navigation_commands),
GTK_STYLE_CLASS_RAISED);
+ gtk_style_context_add_class (gtk_widget_get_style_context (navigation_commands),
GTK_STYLE_CLASS_LINKED);
gtk_box_pack_start (GTK_BOX (location_bar_content), navigation_commands, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (location_bar_content),
diff --git a/src/ui/progress-dialog.ui b/src/ui/progress-dialog.ui
index 6297c43..1b97cf5 100644
--- a/src/ui/progress-dialog.ui
+++ b/src/ui/progress-dialog.ui
@@ -1,132 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.3 -->
<interface>
- <!-- interface-requires gtk+ 3.0 -->
- <object class="GtkDialog" id="progress_dialog">
+ <requires lib="gtk+" version="3.12"/>
+ <object class="GtkHBox" id="progress_dialog_content">
+ <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">5</property>
- <property name="resizable">False</property>
- <property name="type_hint">dialog</property>
- <child internal-child="vbox">
- <object class="GtkBox" id="dialog-vbox1">
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkImage" id="icon_image">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="yalign">0</property>
+ <property name="pixel_size">48</property>
+ <property name="icon_name">package-x-generic</property>
+ <property name="icon_size">6</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="box1">
+ <property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
- <property name="spacing">10</property>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="dialog-action_area1">
+ <property name="spacing">18</property>
+ <child>
+ <object class="GtkLabel" id="action_label">
+ <property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="layout_style">end</property>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
+ <property name="xalign">0</property>
+ <property name="wrap">True</property>
+ <property name="wrap_mode">word-char</property>
</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>
<child>
- <object class="GtkHBox" id="hbox28">
+ <object class="GtkBox" id="progress_box">
<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">2</property>
<child>
- <object class="GtkImage" id="icon_image">
+ <object class="GtkProgressBar" id="progress_progressbar">
+ <property name="width_request">350</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="yalign">0</property>
- <property name="pixel_size">48</property>
- <property name="icon_name">package-x-generic</property>
- <property name="icon-size">6</property>
+ <property name="pulse_step">0.029999999999999999</property>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<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">18</property>
- <child>
- <object class="GtkLabel" id="action_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="wrap">True</property>
- <property name="wrap_mode">word-char</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="progress_box">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <property name="spacing">2</property>
- <child>
- <object class="GtkProgressBar" id="progress_progressbar">
- <property name="width_request">350</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="pulse_step">0.029999999999999999</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <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="ellipsize">end</property>
- <attributes>
- <attribute name="size" value="9000"/>
- </attributes>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </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="ellipsize">end</property>
+ <attributes>
+ <attribute name="size" value="9000"/>
+ </attributes>
</object>
<packing>
- <property name="expand">True</property>
+ <property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
- <property name="expand">True</property>
+ <property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
</child>
</object>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]