tint2conf: Show only one popup during long operations (issue #563)

This commit is contained in:
o9000 2016-03-06 20:49:38 +01:00
parent b0f172a8e1
commit f5236f1d21
3 changed files with 24 additions and 13 deletions

View file

@ -481,7 +481,7 @@ static void edit_current_theme()
sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(g_theme_view));
if (gtk_tree_selection_get_selected(GTK_TREE_SELECTION(sel), &model, &iter)) {
GtkWidget *dialog = create_please_wait();
create_please_wait();
process_events();
gtk_tree_model_get(model, &iter, COL_THEME_FILE, &file, -1);
@ -491,7 +491,7 @@ static void edit_current_theme()
gtk_window_present(GTK_WINDOW(prop));
g_free(file);
gtk_widget_destroy(dialog);
destroy_please_wait();
}
}

View file

@ -2209,7 +2209,7 @@ void set_current_icon_theme(const char *theme)
void icon_theme_changed()
{
GtkWidget *dialog = create_please_wait();
create_please_wait();
process_events();
if (icon_theme)
@ -2227,7 +2227,7 @@ void icon_theme_changed()
load_icons(all_apps);
save_icon_cache(icon_theme);
gtk_widget_destroy(dialog);
destroy_please_wait();
}
void launcher_icon_theme_changed(GtkWidget *widget, gpointer data)
@ -5380,15 +5380,17 @@ void create_tooltip(GtkWidget *parent)
change_paragraph(parent);
}
GtkWidget *create_please_wait()
static GtkWidget *please_wait_dialog = NULL;
void create_please_wait()
{
GtkWidget *dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_NONE, "%s", _("Loading..."));
gtk_window_set_title(GTK_WINDOW(dialog), _("Please wait..."));
gtk_window_set_deletable(GTK_WINDOW(dialog), FALSE);
gtk_window_set_default_size(GTK_WINDOW(dialog), 400, 200);
gtk_widget_show_all(dialog);
gtk_widget_set_size_request(dialog, 300, 100);
return (GtkWidget*)dialog;
if (please_wait_dialog)
return;
please_wait_dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_NONE, "%s", _("Loading..."));
gtk_window_set_title(GTK_WINDOW(please_wait_dialog), _("Please wait..."));
gtk_window_set_deletable(GTK_WINDOW(please_wait_dialog), FALSE);
gtk_window_set_default_size(GTK_WINDOW(please_wait_dialog), 400, 200);
gtk_widget_show_all(please_wait_dialog);
gtk_widget_set_size_request(please_wait_dialog, 300, 100);
}
void process_events()
@ -5396,3 +5398,11 @@ void process_events()
while (gtk_events_pending())
gtk_main_iteration_do(FALSE);
}
void destroy_please_wait()
{
if (!please_wait_dialog)
return;
gtk_widget_destroy(please_wait_dialog);
please_wait_dialog = NULL;
}

View file

@ -204,7 +204,8 @@ Executor *execp_get_last();
void execp_remove(int i);
void execp_update_indices();
GtkWidget *create_please_wait();
void create_please_wait();
void process_events();
void destroy_please_wait();
#endif