2008-10-07 [colin] 3.6.0cvs12
authorColin Leroy <colin@colino.net>
Tue, 7 Oct 2008 14:54:54 +0000 (14:54 +0000)
committerColin Leroy <colin@colino.net>
Tue, 7 Oct 2008 14:54:54 +0000 (14:54 +0000)
* src/mainwindow.c
* src/mainwindow.h
* src/prefs_common.c
* src/prefs_common.h
* src/summaryview.c
* src/gtk/colorlabel.c
Fix bug 1749, 'Shortcut keys for color labels
not changeable'
Make fullscreen a setting remembered between
sessions

ChangeLog
PATCHSETS
configure.ac
src/gtk/colorlabel.c
src/mainwindow.c
src/mainwindow.h
src/prefs_common.c
src/prefs_common.h
src/summaryview.c

index 15a6035..9d5b9e8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2008-10-07 [colin]     3.6.0cvs12
+
+       * src/mainwindow.c
+       * src/mainwindow.h
+       * src/prefs_common.c
+       * src/prefs_common.h
+       * src/summaryview.c
+       * src/gtk/colorlabel.c
+               Fix bug 1749, 'Shortcut keys for color labels 
+               not changeable'
+               Make fullscreen a setting remembered between
+               sessions
+
 2008-10-07 [colin]     3.6.0cvs11
 
        * src/prefs_other.c
index 68aa3b8..6bb2491 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.274.2.278 -r 1.274.2.279 src/mainwindow.c;  ) > 3.6.0cvs9.patchset
 ( cvs diff -u -r 1.274.2.279 -r 1.274.2.280 src/mainwindow.c;  ) > 3.6.0cvs10.patchset
 ( cvs diff -u -r 1.1.2.32 -r 1.1.2.33 src/prefs_other.c;  ) > 3.6.0cvs11.patchset
+( cvs diff -u -r 1.274.2.280 -r 1.274.2.281 src/mainwindow.c;  cvs diff -u -r 1.39.2.52 -r 1.39.2.53 src/mainwindow.h;  cvs diff -u -r 1.204.2.180 -r 1.204.2.181 src/prefs_common.c;  cvs diff -u -r 1.103.2.115 -r 1.103.2.116 src/prefs_common.h;  cvs diff -u -r 1.395.2.394 -r 1.395.2.395 src/summaryview.c;  cvs diff -u -r 1.2.2.23 -r 1.2.2.24 src/gtk/colorlabel.c;  ) > 3.6.0cvs12.patchset
index aad6620..675915f 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=6
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=11
+EXTRA_VERSION=12
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 2543d2c..1b48baa 100644 (file)
@@ -27,6 +27,7 @@
 #include <glib.h>
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
 
 #include "colorlabel.h"
 #include "utils.h"
@@ -328,12 +329,19 @@ GtkWidget *colorlabel_create_check_color_menu_item(gint color_index, gboolean fo
        gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 4);
        if (color_index < 9) {
-               accel = g_strdup_printf(gettext("Ctrl+%c"), '1'+color_index);
+               accel = gtk_accelerator_get_label(GDK_1+color_index, GDK_CONTROL_MASK);
                label = gtk_label_new(accel);
                gtk_widget_show(label);
                gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
                g_free(accel);
                gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 4);
+               g_object_set_data(G_OBJECT(item), "accel_label", label);
+       } else {
+               label = gtk_label_new("");
+               gtk_widget_show(label);
+               gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5);
+               gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, 4);
+               g_object_set_data(G_OBJECT(item), "accel_label", label);
        }
        return item;
 }
index 9fca790..93b11bf 100644 (file)
@@ -1043,6 +1043,27 @@ static void mainwindow_tags_menu_item_activate_cb(GtkWidget *widget,
        summary_set_tag(mainwin->summaryview, id, NULL);
 }
 
+void mainwin_accel_changed_cb (GtkAccelGroup *accelgroup, guint keyval, GdkModifierType modifier,
+                                 GClosure *closure, GtkMenuItem *item)
+{
+       GList *closures = gtk_widget_list_accel_closures(GTK_WIDGET(item));
+       GList *cur;
+       for (cur = closures; cur; cur = cur->next) {
+               if (closure == cur->data) {
+                       GtkLabel *label = g_object_get_data(G_OBJECT(item), "accel_label");
+                       gchar *new_accel;
+                       
+                       if (keyval == GDK_BackSpace) {
+                               keyval = 0; modifier = 0;
+                               gtk_accel_map_change_entry (gtk_menu_item_get_accel_path(item), keyval, modifier, TRUE);
+                       }
+                       new_accel = gtk_accelerator_get_label(keyval, modifier);
+                       gtk_label_set_text(label, new_accel);
+                       g_free(new_accel);
+               }
+       }
+}
+
 static void mainwindow_colorlabel_menu_create(MainWindow *mainwin, gboolean refresh)
 {
        GtkWidget *label_menuitem;
@@ -1094,11 +1115,15 @@ static void mainwindow_colorlabel_menu_create(MainWindow *mainwin, gboolean refr
                g_object_set_data(G_OBJECT(item), "mainwin",
                                  mainwin);
                gtk_widget_show(item);
-               accel_path = g_strdup_printf("<ClawsColorLabels>/%d", i);
+               accel_path = g_strdup_printf("<ClawsColorLabels>/%d", i+1);
                gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), accel_path);
                if (i < 9)
                        gtk_accel_map_add_entry(accel_path, GDK_1+i, GDK_CONTROL_MASK);
                g_free(accel_path);
+               g_signal_connect (gtk_ui_manager_get_accel_group(mainwin->ui_manager), 
+                       "accel-changed", G_CALLBACK (mainwin_accel_changed_cb), item);
+
+
        }
        gtk_widget_show(menu);
        gtk_menu_item_set_submenu(GTK_MENU_ITEM(label_menuitem), menu);
@@ -1908,7 +1933,6 @@ MainWindow *main_window_create()
        hildon_window_set_menu(HILDON_WINDOW(window), GTK_MENU(menubar));
 #endif
 
-
        if (prefs_common.toolbar_detachable) {
                handlebox = gtk_handle_box_new();
                gtk_widget_show(handlebox);
@@ -2246,8 +2270,13 @@ MainWindow *main_window_create()
 #ifdef MAEMO
        main_window_install_maemo_hooks(mainwin);
 #endif
-        mainwin->fullscreen = FALSE;
-
+#ifndef MAEMO
+       if (prefs_common.mainwin_fullscreen) {
+               cm_toggle_menu_set_active_full(mainwin->ui_manager, 
+                       "Menu/View/FullScreen",
+                       TRUE);
+       }
+#endif
        return mainwin;
 }
 
@@ -2825,11 +2854,11 @@ void main_window_get_size(MainWindow *mainwin)
 
        allocation = &(GTK_WIDGET_PTR(mainwin->summaryview)->allocation);
        
-       if (mainwin->fullscreen) {
+       if (prefs_common.mainwin_fullscreen) {
                debug_print("mainwin in full screen state. "
                            "Keeping original settings\n");
        }
-       if (allocation->width > 1 && allocation->height > 1 && !mainwin->fullscreen) {
+       if (allocation->width > 1 && allocation->height > 1 && !prefs_common.mainwin_fullscreen) {
                prefs_common.summaryview_width = allocation->width;
 
                if (messageview_is_visible(mainwin->messageview))
@@ -2840,7 +2869,7 @@ void main_window_get_size(MainWindow *mainwin)
 
        allocation = &mainwin->window->allocation;
        if (allocation->width > 1 && allocation->height > 1 &&
-           !prefs_common.mainwin_maximised && !mainwin->fullscreen) {
+           !prefs_common.mainwin_maximised && !prefs_common.mainwin_fullscreen) {
                prefs_common.mainview_height = allocation->height;
                prefs_common.mainwin_width   = allocation->width;
                prefs_common.mainwin_height  = allocation->height;
@@ -2848,14 +2877,14 @@ void main_window_get_size(MainWindow *mainwin)
 
        allocation = &(GTK_WIDGET_PTR(mainwin->folderview)->allocation);
        if (allocation->width > 1 && allocation->height > 1 &&
-           !mainwin->fullscreen) {
+           !prefs_common.mainwin_fullscreen) {
                prefs_common.folderview_width  = allocation->width;
                prefs_common.folderview_height = allocation->height;
        }
 
        allocation = &(GTK_WIDGET_PTR(mainwin->messageview)->allocation);
        if (allocation->width > 1 && allocation->height > 1 &&
-           !mainwin->fullscreen) {
+           !prefs_common.mainwin_fullscreen) {
                prefs_common.msgview_width = allocation->width;
                prefs_common.msgview_height = allocation->height;
        }
@@ -2875,7 +2904,7 @@ void main_window_get_position(MainWindow *mainwin)
 {
        gint x, y;
 
-       if (prefs_common.mainwin_maximised || mainwin->fullscreen)
+       if (prefs_common.mainwin_maximised || prefs_common.mainwin_fullscreen)
                return;
 
        gtkut_widget_get_uposition(mainwin->window, &x, &y);
@@ -4255,10 +4284,10 @@ static void toggle_fullscreen_cb(GtkAction *action, gpointer data)
        if (mainwin->menu_lock_count) return;
        if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
                gtk_window_unfullscreen(GTK_WINDOW(mainwin->window));
-               mainwin->fullscreen = FALSE;
+               prefs_common.mainwin_fullscreen = FALSE;
        }
        else {
-               mainwin->fullscreen = TRUE;
+               prefs_common.mainwin_fullscreen = TRUE;
                gtk_window_fullscreen(GTK_WINDOW(mainwin->window));
        }
 }
index 095cc54..0e74cc3 100644 (file)
@@ -142,8 +142,6 @@ struct _MainWindow
        gboolean         in_folder;
        GtkActionGroup  *action_group;
        GtkUIManager    *ui_manager;
-
-        gboolean        fullscreen;
 };
 
 MainWindow *main_window_create         (void);
@@ -214,4 +212,7 @@ void maemo_connect_key_press_to_mainwindow    (GtkWindow *window);
 void mainwindow_maemo_led_set(gboolean state);
 #endif
 
+void mainwin_accel_changed_cb (GtkAccelGroup *accelgroup, guint keyval, GdkModifierType modifier,
+                                 GClosure *closure, GtkMenuItem *item);
+
 #endif /* __MAINWINDOW_H__ */
index 00895da..2f368fc 100644 (file)
@@ -634,6 +634,8 @@ static PrefParam param[] = {
         NULL, NULL, NULL},
        {"mainwin_maximised", "FALSE", &prefs_common.mainwin_maximised, P_BOOL,
         NULL, NULL, NULL},
+       {"mainwin_fullscreen", "FALSE", &prefs_common.mainwin_fullscreen, P_BOOL,
+        NULL, NULL, NULL},
 #ifndef GENERIC_UMPC
        {"mainwin_width", "800", &prefs_common.mainwin_width, P_INT,
         NULL, NULL, NULL},
index bee484c..c7cece4 100644 (file)
@@ -278,6 +278,7 @@ struct _PrefsCommon
        gint mainwin_width;
        gint mainwin_height;
        gint mainwin_maximised;
+       gint mainwin_fullscreen;
 
        gint msgwin_width;
        gint msgwin_height;
index 54d541a..9d51b97 100644 (file)
@@ -5798,11 +5798,13 @@ static void summary_colorlabel_menu_create(SummaryView *summaryview, gboolean re
                g_object_set_data(G_OBJECT(item), "summaryview",
                                  summaryview);
                gtk_widget_show(item);
-               accel_path = g_strdup_printf("<ClawsColorLabels>/%d", i);
+               accel_path = g_strdup_printf("<ClawsColorLabels>/%d", i+1);
                gtk_menu_item_set_accel_path(GTK_MENU_ITEM(item), accel_path);
                if (i < 9)
                        gtk_accel_map_add_entry(accel_path, GDK_1+i, GDK_CONTROL_MASK);
                g_free(accel_path);
+               g_signal_connect (gtk_ui_manager_get_accel_group(mainwindow_get_mainwindow()->ui_manager), 
+                       "accel-changed", G_CALLBACK (mainwin_accel_changed_cb), item);
        }
 
        gtk_widget_show(menu);