Revision: 535 http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=535&view=rev Author: kugel- Date: 2009-03-07 19:43:19 +0000 (Sat, 07 Mar 2009)
Log Message: ----------- Commit dialog: a) Add a checkbox to select or deselect all files at once, makes it easier to commit very few files only in a branch with many changes. b) Always base the file list off the base directory, fixes situations where you cannot commit if the project as no files in the base directory.
Modified Paths: -------------- trunk/geanyvc/geanyvc.c trunk/geanyvc/po/de.po
Modified: trunk/geanyvc/geanyvc.c =================================================================== --- trunk/geanyvc/geanyvc.c 2009-03-07 16:50:04 UTC (rev 534) +++ trunk/geanyvc/geanyvc.c 2009-03-07 19:43:19 UTC (rev 535) @@ -1110,15 +1110,23 @@ }
static void +refresh_diff_view(GtkTreeView *treeview) +{ + gchar *diff; + GtkWidget *diffView = ui_lookup_widget(GTK_WIDGET(treeview), "textDiff"); + diff = get_commit_diff(GTK_TREE_VIEW(treeview)); + set_diff_buff(gtk_text_view_get_buffer(GTK_TEXT_VIEW(diffView)), diff); + g_free(diff); +} + +static void commit_toggled(G_GNUC_UNUSED GtkCellRendererToggle * cell, gchar * path_str, gpointer data) { GtkTreeView *treeview = GTK_TREE_VIEW(data); - GtkWidget *diffView = ui_lookup_widget(GTK_WIDGET(treeview), "textDiff"); GtkTreeModel *model = gtk_tree_view_get_model(treeview); GtkTreeIter iter; GtkTreePath *path = gtk_tree_path_new_from_string(path_str); gboolean fixed; - gchar *diff;
/* get toggled iter */ gtk_tree_model_get_iter(model, &iter, path); @@ -1130,15 +1138,36 @@ /* set new value */ gtk_list_store_set(GTK_LIST_STORE(model), &iter, COLUMN_COMMIT, fixed, -1);
- diff = get_commit_diff(GTK_TREE_VIEW(treeview)); - set_diff_buff(gtk_text_view_get_buffer(GTK_TEXT_VIEW(diffView)), diff); + refresh_diff_view(treeview);
/* clean up */ gtk_tree_path_free(path); - g_free(diff); }
+gboolean +toggle_all_commit_files (GtkTreeModel *model, GtkTreePath *path, + GtkTreeIter *iter, gpointer data) +{ + (void)path; + gtk_list_store_set(GTK_LIST_STORE(model), iter, COLUMN_COMMIT, *(gint*)data, -1); + return FALSE; +} + static void +commit_all_toggled(G_GNUC_UNUSED GtkCellRendererToggle *cell, gpointer data) +{ + GtkTreeView *treeview = GTK_TREE_VIEW(data); + GtkTreeModel *model = gtk_tree_view_get_model(treeview); + static gint onoff = 0; + gpointer ptr_onoff = &onoff; + + gtk_tree_model_foreach(model, toggle_all_commit_files, ptr_onoff); + /* toggle value */ + onoff ^= 1; + refresh_diff_view(treeview); +} + +static void add_commit_columns(GtkTreeView * treeview) { GtkCellRenderer *renderer; @@ -1201,6 +1230,7 @@ GtkWidget *scrolledwindow1; GtkWidget *treeSelect; GtkWidget *vpaned2; + GtkWidget *vpaned3; GtkWidget *scrolledwindow2; GtkWidget *textDiff; GtkWidget *frame1; @@ -1211,6 +1241,7 @@ GtkWidget *dialog_action_area1; GtkWidget *btnCancel; GtkWidget *btnCommit; + GtkWidget *select_cbox;
gchar *rcstyle = g_strdup_printf("style "geanyvc-diff-font"\n" "{\n" @@ -1265,6 +1296,16 @@ GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindow2), GTK_SHADOW_IN);
+ vpaned3 = gtk_vpaned_new(); + gtk_widget_show(vpaned3); + gtk_paned_pack2(GTK_PANED(vpaned2), vpaned3, FALSE, FALSE); + + select_cbox = gtk_check_button_new_with_mnemonic(_("_De-/select all files")); + gtk_toggle_button_set_active((GtkToggleButton*)select_cbox, TRUE); + gtk_widget_show(select_cbox); + gtk_paned_pack1(GTK_PANED(vpaned3), select_cbox, FALSE, FALSE); + g_signal_connect(select_cbox, "toggled", G_CALLBACK(commit_all_toggled), treeSelect); + textDiff = gtk_text_view_new(); gtk_widget_set_name(textDiff, "GeanyVCCommitDialogDiff"); gtk_widget_show(textDiff); @@ -1276,7 +1317,7 @@
frame1 = gtk_frame_new(NULL); gtk_widget_show(frame1); - gtk_paned_pack2(GTK_PANED(vpaned2), frame1, TRUE, TRUE); + gtk_paned_pack2(GTK_PANED(vpaned3), frame1, TRUE, TRUE); gtk_frame_set_shadow_type(GTK_FRAME(frame1), GTK_SHADOW_NONE);
alignment1 = gtk_alignment_new(0.5, 0.5, 1, 1); @@ -1291,6 +1332,7 @@ GTK_POLICY_AUTOMATIC); gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindow3), GTK_SHADOW_IN);
+ textCommitMessage = gtk_text_view_new(); gtk_widget_show(textCommitMessage); gtk_container_add(GTK_CONTAINER(scrolledwindow3), textCommitMessage); @@ -1332,6 +1374,7 @@ GLADE_HOOKUP_OBJECT_NO_REF(commitDialog, dialog_action_area1, "dialog_action_area1"); GLADE_HOOKUP_OBJECT(commitDialog, btnCancel, "btnCancel"); GLADE_HOOKUP_OBJECT(commitDialog, btnCommit, "btnCommit"); + GLADE_HOOKUP_OBJECT(commitDialog, select_cbox, "select_cbox");
return commitDialog; } @@ -1372,10 +1415,9 @@ doc = document_get_current(); g_return_if_fail(doc); g_return_if_fail(doc->file_name); - dir = g_path_get_dirname(doc->file_name); - - vc = find_vc(dir); + vc = find_vc(doc->file_name); g_return_if_fail(vc); + dir = vc->get_base_dir(doc->file_name);
lst = vc->get_commit_files(dir); if (!lst)
Modified: trunk/geanyvc/po/de.po =================================================================== --- trunk/geanyvc/po/de.po 2009-03-07 16:50:04 UTC (rev 534) +++ trunk/geanyvc/po/de.po 2009-03-07 19:43:19 UTC (rev 535) @@ -92,6 +92,10 @@ msgid "Commit" msgstr "Übertragen"
+#: ../geanyvc.c:1303 +msgid "_De-/select all files" +msgstr "Alle _Dateien aus- bzw. abwählen" + #: ../geanyvc.c:1301 msgid "<b>Commit message:</b>" msgstr "<b>Commitnachricht:</b>"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.