Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Sun, 27 May 2012 18:25:19 Commit: 2ed1d6d8bbc936a8a21d205d34cf9910114632c0 https://github.com/geany/geany/commit/2ed1d6d8bbc936a8a21d205d34cf9910114632...
Log Message: ----------- Do not apply color scheme upon color scheme selection dialog display
Current color scheme was applied upon color scheme selection dialog display because the GtkTreeView::cursor-changed signal is emitted when the tree view is initially shown (since it actually gets the focus for the first time), uselessly re-applying the current color scheme.
This is a performance issue because when many documents are open updating the color scheme can take a few seconds.
Now we watch for the GtkTreeSelection::changed signal on the tree view's selection, which is only emitted when the selected item actually changes. We also connect to that signal after filling the tree so we don't get notified on the initial selection setup.
Modified Paths: -------------- src/highlighting.c
Modified: src/highlighting.c 10 files changed, 5 insertions(+), 5 deletions(-) =================================================================== @@ -1175,16 +1175,13 @@ enum SCHEME_COLUMNS };
-static void -on_color_scheme_changed(void) +static void on_color_scheme_changed(GtkTreeSelection *treesel, gpointer dummy) { - GtkTreeSelection *treesel; GtkTreeModel *model; GtkTreeIter iter; gchar *fname; gchar *path;
- treesel = gtk_tree_view_get_selection(GTK_TREE_VIEW(scheme_tree)); if (!gtk_tree_selection_get_selected(treesel, &model, &iter)) return; gtk_tree_model_get(model, &iter, SCHEME_FILE, &fname, -1); @@ -1319,13 +1316,13 @@ void highlighting_show_color_scheme_dialog(void) G_TYPE_STRING, G_TYPE_STRING); GtkCellRenderer *text_renderer; GtkTreeViewColumn *column; + GtkTreeSelection *treesel; GtkWidget *vbox, *swin, *tree;
scheme_tree = tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); g_object_unref(store); gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(tree), TRUE); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), FALSE); - g_signal_connect(tree, "cursor-changed", on_color_scheme_changed, NULL);
text_renderer = gtk_cell_renderer_text_new(); g_object_set(text_renderer, "wrap-mode", PANGO_WRAP_WORD, NULL); @@ -1335,6 +1332,9 @@ void highlighting_show_color_scheme_dialog(void)
add_color_scheme_items(store);
+ treesel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); + g_signal_connect(treesel, "changed", G_CALLBACK(on_color_scheme_changed), NULL); + /* old dialog may still be showing */ if (dialog) gtk_widget_destroy(dialog);
@@ Diff output truncated at 100000 characters. @@
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: TBD).