diff options
author | infirit <[email protected]> | 2014-11-21 13:44:47 +0100 |
---|---|---|
committer | infirit <[email protected]> | 2014-11-21 13:44:47 +0100 |
commit | b8c7de3fbbefe00fac750bf67dfb61797ba41938 (patch) | |
tree | 7af1468dc1f4dfe8dbdf18e08d7bb94b9db48270 /src | |
parent | 907d797ad2f9d4bfacacf01ce1153309825d49e6 (diff) | |
download | engrampa-b8c7de3fbbefe00fac750bf67dfb61797ba41938.tar.bz2 engrampa-b8c7de3fbbefe00fac750bf67dfb61797ba41938.tar.xz |
added an icon to the progress dialog
Based on FR commit: f6fa4bdb5ccc059a6b13938e6b017bcefed2c8ab
From: Paolo Bacchilega <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/dlg-batch-add.c | 34 | ||||
-rw-r--r-- | src/fr-window.c | 44 | ||||
-rw-r--r-- | src/gtk-utils.c | 13 | ||||
-rw-r--r-- | src/gtk-utils.h | 6 |
4 files changed, 49 insertions, 48 deletions
diff --git a/src/dlg-batch-add.c b/src/dlg-batch-add.c index f2f74b5..0b56740 100644 --- a/src/dlg-batch-add.c +++ b/src/dlg-batch-add.c @@ -326,7 +326,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) { @@ -397,10 +396,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); } @@ -455,10 +460,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; @@ -484,13 +485,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); @@ -498,8 +492,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); @@ -540,8 +534,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. */ @@ -549,15 +543,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 (G_OBJECT (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 faebd29..0d67bfd 100644 --- a/src/fr-window.c +++ b/src/fr-window.c @@ -371,6 +371,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. */ @@ -2459,6 +2460,7 @@ create_the_progress_dialog (FrWindow *window) GtkWindow *parent; GtkDialogFlags flags; GtkDialog *d; + GtkWidget *hbox; GtkWidget *vbox; GtkWidget *align; GtkWidget *progress_vbox; @@ -2466,6 +2468,7 @@ create_the_progress_dialog (FrWindow *window) const char *title; char *markup; PangoAttrList *attr_list; + GdkPixbuf *icon; if (window->priv->progress_dialog != NULL) return; @@ -2499,9 +2502,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 */ @@ -2576,7 +2589,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 */ @@ -5014,17 +5027,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, @@ -5370,7 +5374,6 @@ fr_window_construct (FrWindow *window) GtkWidget *sidepane_title_label; GtkWidget *close_sidepane_button; GtkTreeSelection *selection; - int icon_width, icon_height; GtkActionGroup *actions; GtkAction *action; GtkUIManager *ui; @@ -5428,15 +5431,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 56ba99b..40d5336 100644 --- a/src/gtk-utils.c +++ b/src/gtk-utils.c @@ -742,7 +742,6 @@ get_mime_type_pixbuf (const char *mime_type, return pixbuf; } - int get_folder_pixbuf_size_for_list (GtkWidget *widget) { @@ -754,7 +753,6 @@ get_folder_pixbuf_size_for_list (GtkWidget *widget) return MAX (icon_width, icon_height); } - gboolean show_uri (GdkScreen *screen, const char *uri, @@ -828,3 +826,14 @@ _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 f011fba..64ff68a 100644 --- a/src/gtk-utils.h +++ b/src/gtk-utils.h @@ -76,7 +76,7 @@ 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); +int get_folder_pixbuf_size_for_list (GtkWidget *widget); gboolean show_uri (GdkScreen *screen, const char *uri, guint32 timestamp, @@ -88,5 +88,7 @@ GtkBuilder * GtkWidget * _gtk_builder_get_widget (GtkBuilder *builder, const char *name); - + +int _gtk_widget_lookup_for_size (GtkWidget *widget, + GtkIconSize icon_size); #endif |