Skip to content
Snippets Groups Projects
Commit eb89a0fd authored by Nick Schermer's avatar Nick Schermer
Browse files

Create status icon when we're actually going to display it.

The show/hide in status icons emits a critical warning (in the
plug window) because of the quick hide we do after creating in
status icon. This crashes the status icon in the panel.
Although this is a problem in Gtk, it is also better to delay
creating the status icon until we actually show it.
parent ee62db37
No related branches found
No related tags found
No related merge requests found
......@@ -112,13 +112,6 @@ thunar_progress_dialog_init (ThunarProgressDialog *dialog)
gtk_container_set_border_width (GTK_CONTAINER (dialog->content_box), 8);
gtk_container_add (GTK_CONTAINER (dialog->vbox), dialog->content_box);
gtk_widget_show (dialog->content_box);
dialog->status_icon = gtk_status_icon_new_from_icon_name ("stock_folder-copy");
gtk_status_icon_set_visible (dialog->status_icon, FALSE);
g_signal_connect_swapped (dialog->status_icon, "button-press-event",
G_CALLBACK (thunar_progress_dialog_toggled),
GTK_WIDGET (dialog));
}
......@@ -137,7 +130,8 @@ thunar_progress_dialog_finalize (GObject *object)
ThunarProgressDialog *dialog = THUNAR_PROGRESS_DIALOG (object);
/* destroy the status icon */
g_object_unref (dialog->status_icon);
if (dialog->status_icon != NULL)
g_object_unref (dialog->status_icon);
/* free the view list */
g_list_free (dialog->views);
......@@ -153,7 +147,14 @@ thunar_progress_dialog_shown (ThunarProgressDialog *dialog)
_thunar_return_if_fail (THUNAR_IS_PROGRESS_DIALOG (dialog));
/* show the status icon */
gtk_status_icon_set_visible (dialog->status_icon, TRUE);
if (dialog->status_icon == NULL)
{
dialog->status_icon = gtk_status_icon_new_from_icon_name ("stock_folder-copy");
thunar_progress_dialog_update_status_icon (dialog);
g_signal_connect_swapped (dialog->status_icon, "button-press-event",
G_CALLBACK (thunar_progress_dialog_toggled),
GTK_WIDGET (dialog));
}
}
......@@ -267,7 +268,8 @@ thunar_progress_dialog_job_finished (ThunarProgressDialog *dialog,
if (dialog->views != NULL)
{
/* update the status icon */
thunar_progress_dialog_update_status_icon (dialog);
if (dialog->status_icon != NULL)
thunar_progress_dialog_update_status_icon (dialog);
}
else
{
......@@ -285,7 +287,8 @@ thunar_progress_dialog_update_status_icon (ThunarProgressDialog *dialog)
guint n_views;
_thunar_return_if_fail (THUNAR_IS_PROGRESS_DIALOG (dialog));
_thunar_return_if_fail (GTK_IS_STATUS_ICON (dialog->status_icon));
/* determine the number of views now being active */
n_views = g_list_length (dialog->views);
......@@ -293,7 +296,7 @@ thunar_progress_dialog_update_status_icon (ThunarProgressDialog *dialog)
tooltip_text = g_strdup_printf (ngettext ("%d file operation running",
"%d file operations running",
n_views),
n_views);
n_views);
/* update the tooltip */
#if GTK_CHECK_VERSION (2, 16, 0)
......@@ -369,7 +372,8 @@ thunar_progress_dialog_add_job (ThunarProgressDialog *dialog,
g_signal_connect_swapped (view, "finished",
G_CALLBACK (thunar_progress_dialog_job_finished), dialog);
thunar_progress_dialog_update_status_icon (dialog);
if (dialog->status_icon != NULL)
thunar_progress_dialog_update_status_icon (dialog);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment