[file-roller] added an icon to the progress dialog
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [file-roller] added an icon to the progress dialog
- Date: Thu, 4 Aug 2011 10:20:00 +0000 (UTC)
commit f6fa4bdb5ccc059a6b13938e6b017bcefed2c8ab
Author: Paolo Bacchilega <paobac src gnome org>
Date: Thu Aug 4 11:53:47 2011 +0200
added an icon to the progress dialog
src/dlg-batch-add.c | 34 ++++++++++++++--------------------
src/fr-window.c | 44 ++++++++++++++++++++------------------------
src/gtk-utils.c | 24 ++++++++++++------------
src/gtk-utils.h | 6 ++++--
4 files changed, 50 insertions(+), 58 deletions(-)
---
diff --git a/src/dlg-batch-add.c b/src/dlg-batch-add.c
index eeac95f..2bf7a31 100644
--- a/src/dlg-batch-add.c
+++ b/src/dlg-batch-add.c
@@ -324,7 +324,6 @@ add_clicked_cb (GtkWidget *widget,
GFile *file;
GError *err = NULL;
- /* FIXME: convert this code in a function in file-utils.c */
file = g_file_new_for_uri (archive_file);
g_file_delete (file, NULL, &err);
if (err != NULL) {
@@ -395,10 +394,16 @@ archive_type_combo_box_changed_cb (GtkComboBox *combo_box,
{
const char *mime_type;
int idx = gtk_combo_box_get_active (combo_box);
+ GdkPixbuf *icon;
mime_type = mime_type_desc[data->supported_types[idx]].mime_type;
- gtk_image_set_from_pixbuf (GTK_IMAGE (GET_WIDGET ("a_add_image")), get_mime_type_pixbuf (mime_type, ARCHIVE_ICON_SIZE, NULL));
+ icon = get_mime_type_pixbuf (mime_type, ARCHIVE_ICON_SIZE, NULL);
+ if (icon != NULL) {
+ gtk_image_set_from_pixbuf (GTK_IMAGE (GET_WIDGET ("archive_icon_image")), icon);
+ g_object_unref (icon);
+ }
+
update_sensitivity_for_mime_type (data, mime_type);
}
@@ -453,10 +458,6 @@ dlg_batch_add_files (FrWindow *window,
GList *file_list)
{
DialogData *data;
- GtkWidget *cancel_button;
- GtkWidget *help_button;
- GtkWidget *add_button;
- GtkWidget *a_archive_type_box;
GtkSizeGroup *size_group;
char *automatic_name = NULL;
char *default_ext;
@@ -481,13 +482,6 @@ dlg_batch_add_files (FrWindow *window,
data->single_file = ((file_list->next == NULL) && uri_is_file ((char*) file_list->data));
data->add_clicked = FALSE;
- /* Get the widgets. */
-
- add_button = GET_WIDGET ("a_add_button");
- cancel_button = GET_WIDGET ("a_cancel_button");
- help_button = GET_WIDGET ("a_help_button");
- a_archive_type_box = GET_WIDGET ("a_archive_type_box");
-
/* Set widgets data. */
size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
@@ -495,8 +489,8 @@ dlg_batch_add_files (FrWindow *window,
gtk_size_group_add_widget (size_group, GET_WIDGET ("a_location_label"));
gtk_size_group_add_widget (size_group, GET_WIDGET ("a_password_label"));
- gtk_button_set_use_stock (GTK_BUTTON (add_button), TRUE);
- gtk_button_set_label (GTK_BUTTON (add_button), FR_STOCK_CREATE_ARCHIVE);
+ gtk_button_set_use_stock (GTK_BUTTON (GET_WIDGET ("a_add_button")), TRUE);
+ gtk_button_set_label (GTK_BUTTON (GET_WIDGET ("a_add_button")), FR_STOCK_CREATE_ARCHIVE);
gtk_expander_set_expanded (GTK_EXPANDER (GET_WIDGET ("a_other_options_expander")), FALSE /*g_settings_get_boolean (data->settings, PREF_BATCH_ADD_OTHER_OPTIONS)*/);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("a_encrypt_header_checkbutton")), g_settings_get_boolean (data->settings_general, PREF_GENERAL_ENCRYPT_HEADER));
gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("a_volume_spinbutton")), (double) g_settings_get_int (data->settings, PREF_BATCH_ADD_VOLUME_SIZE) / MEGABYTE);
@@ -536,8 +530,8 @@ dlg_batch_add_files (FrWindow *window,
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (data->archive_type_combo_box),
mime_type_desc[data->supported_types[i]].default_ext);
- gtk_box_pack_start (GTK_BOX (a_archive_type_box), data->archive_type_combo_box, TRUE, TRUE, 0);
- gtk_widget_show_all (a_archive_type_box);
+ gtk_box_pack_start (GTK_BOX (GET_WIDGET ("a_archive_type_box")), data->archive_type_combo_box, TRUE, TRUE, 0);
+ gtk_widget_show_all (GET_WIDGET ("a_archive_type_box"));
/* Set the signals handlers. */
@@ -545,15 +539,15 @@ dlg_batch_add_files (FrWindow *window,
"destroy",
G_CALLBACK (destroy_cb),
data);
- g_signal_connect_swapped (G_OBJECT (cancel_button),
+ g_signal_connect_swapped (GET_WIDGET ("a_cancel_button"),
"clicked",
G_CALLBACK (gtk_widget_destroy),
G_OBJECT (GET_WIDGET ("dialog")));
- g_signal_connect (G_OBJECT (add_button),
+ g_signal_connect (G_OBJECT (GET_WIDGET ("a_add_button")),
"clicked",
G_CALLBACK (add_clicked_cb),
data);
- g_signal_connect (G_OBJECT (help_button),
+ g_signal_connect (GET_WIDGET ("a_help_button"),
"clicked",
G_CALLBACK (help_clicked_cb),
data);
diff --git a/src/fr-window.c b/src/fr-window.c
index afe83ef..682112a 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -367,6 +367,7 @@ struct _FrWindowPrivateData {
GtkWidget *pd_open_archive_button;
GtkWidget *pd_open_destination_button;
GtkWidget *pd_quit_button;
+ GtkWidget *pd_icon;
gboolean progress_pulse;
guint progress_timeout; /* Timeout to display the progress dialog. */
guint hide_progress_timeout; /* Timeout to hide the progress dialog. */
@@ -2497,6 +2498,7 @@ create_the_progress_dialog (FrWindow *window)
{
GtkWindow *parent;
GtkDialog *d;
+ GtkWidget *hbox;
GtkWidget *vbox;
GtkWidget *align;
GtkWidget *progress_vbox;
@@ -2504,6 +2506,7 @@ create_the_progress_dialog (FrWindow *window)
const char *title;
char *markup;
PangoAttrList *attr_list;
+ GdkPixbuf *icon;
if (window->priv->progress_dialog != NULL)
return;
@@ -2533,9 +2536,19 @@ create_the_progress_dialog (FrWindow *window)
/* Main */
+ hbox = gtk_hbox_new (FALSE, 24);
+ gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (d)), hbox, FALSE, FALSE, 10);
+
+ icon = get_mime_type_pixbuf ("package-x-generic", _gtk_widget_lookup_for_size (GTK_WIDGET (window), GTK_ICON_SIZE_DIALOG), NULL);
+ window->priv->pd_icon = gtk_image_new_from_pixbuf (icon);
+ g_object_unref (icon);
+
+ gtk_misc_set_alignment (GTK_MISC (window->priv->pd_icon), 0.5, 0.0);
+ gtk_box_pack_start (GTK_BOX (hbox), window->priv->pd_icon, FALSE, FALSE, 0);
+
vbox = gtk_vbox_new (FALSE, 5);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
- gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (d)), vbox, FALSE, FALSE, 10);
+ gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
/* action label */
@@ -2610,7 +2623,7 @@ create_the_progress_dialog (FrWindow *window)
gtk_label_set_ellipsize (GTK_LABEL (lbl), PANGO_ELLIPSIZE_END);
gtk_box_pack_start (GTK_BOX (progress_vbox), lbl, TRUE, TRUE, 0);
- gtk_widget_show_all (vbox);
+ gtk_widget_show_all (hbox);
/* signals */
@@ -5058,17 +5071,8 @@ pref_use_mime_icons_changed (GSettings *settings,
static void
theme_changed_cb (GtkIconTheme *theme, FrWindow *window)
{
- int icon_width, icon_height;
-
- gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (GTK_WIDGET (window)),
- FILE_LIST_ICON_SIZE,
- &icon_width, &icon_height);
- file_list_icon_size = MAX (icon_width, icon_height);
-
- gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (GTK_WIDGET (window)),
- DIR_TREE_ICON_SIZE,
- &icon_width, &icon_height);
- dir_tree_icon_size = MAX (icon_width, icon_height);
+ file_list_icon_size = _gtk_widget_lookup_for_size (GTK_WIDGET (window), FILE_LIST_ICON_SIZE);
+ dir_tree_icon_size = _gtk_widget_lookup_for_size (GTK_WIDGET (window), DIR_TREE_ICON_SIZE);
if (pixbuf_hash != NULL) {
g_hash_table_foreach (pixbuf_hash,
@@ -5414,7 +5418,6 @@ fr_window_construct (FrWindow *window)
GtkWidget *sidepane_title_label;
GtkWidget *close_sidepane_button;
GtkTreeSelection *selection;
- int icon_width, icon_height;
GtkActionGroup *actions;
GtkUIManager *ui;
GtkToolItem *open_recent_tool_item;
@@ -5463,15 +5466,8 @@ fr_window_construct (FrWindow *window)
G_CALLBACK (theme_changed_cb),
window);
- gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (GTK_WIDGET (window)),
- FILE_LIST_ICON_SIZE,
- &icon_width, &icon_height);
- file_list_icon_size = MAX (icon_width, icon_height);
-
- gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (GTK_WIDGET (window)),
- DIR_TREE_ICON_SIZE,
- &icon_width, &icon_height);
- dir_tree_icon_size = MAX (icon_width, icon_height);
+ file_list_icon_size = _gtk_widget_lookup_for_size (GTK_WIDGET (window), FILE_LIST_ICON_SIZE);
+ dir_tree_icon_size = _gtk_widget_lookup_for_size (GTK_WIDGET (window), DIR_TREE_ICON_SIZE);
gtk_window_set_default_size (GTK_WINDOW (window),
g_settings_get_int (window->priv->settings_ui, PREF_UI_WINDOW_WIDTH),
diff --git a/src/gtk-utils.c b/src/gtk-utils.c
index 1fdb8e4..4e6f40d 100644
--- a/src/gtk-utils.c
+++ b/src/gtk-utils.c
@@ -710,18 +710,6 @@ get_mime_type_pixbuf (const char *mime_type,
}
-int
-get_folder_pixbuf_size_for_list (GtkWidget *widget)
-{
- int icon_width, icon_height;
-
- gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (widget),
- GTK_ICON_SIZE_SMALL_TOOLBAR,
- &icon_width, &icon_height);
- return MAX (icon_width, icon_height);
-}
-
-
gboolean
show_uri (GdkScreen *screen,
const char *uri,
@@ -795,3 +783,15 @@ _gtk_builder_get_widget (GtkBuilder *builder,
{
return (GtkWidget *) gtk_builder_get_object (builder, name);
}
+
+
+int
+_gtk_widget_lookup_for_size (GtkWidget *widget,
+ GtkIconSize icon_size)
+{
+ int w, h;
+ gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (widget),
+ icon_size,
+ &w, &h);
+ return MAX (w, h);
+}
diff --git a/src/gtk-utils.h b/src/gtk-utils.h
index 2d2fe06..dfb3b5d 100644
--- a/src/gtk-utils.h
+++ b/src/gtk-utils.h
@@ -75,7 +75,6 @@ GdkPixbuf * get_icon_pixbuf (GIcon *icon,
GdkPixbuf * get_mime_type_pixbuf (const char *mime_type,
int icon_size,
GtkIconTheme *icon_theme);
-int get_folder_pixbuf_size_for_list (GtkWidget *widget);
gboolean show_uri (GdkScreen *screen,
const char *uri,
guint32 timestamp,
@@ -87,5 +86,8 @@ GtkBuilder *
GtkWidget *
_gtk_builder_get_widget (GtkBuilder *builder,
const char *name);
-
+
+int _gtk_widget_lookup_for_size (GtkWidget *widget,
+ GtkIconSize icon_size);
+
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]