2010-07-10 [colin] 3.7.6cvs16
authorColin Leroy <colin@colino.net>
Sat, 10 Jul 2010 06:42:44 +0000 (06:42 +0000)
committerColin Leroy <colin@colino.net>
Sat, 10 Jul 2010 06:42:44 +0000 (06:42 +0000)
* src/mainwindow.c
* src/gtk/quicksearch.c
Clean fix for bug #2224: don't mess with GTK settings when
handling the layout ourselves is enough

ChangeLog
PATCHSETS
configure.ac
src/gtk/quicksearch.c
src/mainwindow.c

index a4cc6c1..96098e7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-07-10 [colin]     3.7.6cvs16
+
+       * src/mainwindow.c
+       * src/gtk/quicksearch.c
+               Clean fix for bug #2224: don't mess with GTK settings when
+               handling the layout ourselves is enough
+
 2010-07-09 [iwkse]     3.7.6cvs15
 
        * src/mainwindow.h
index 9c4a1da..f979b15 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.2.2.40 -r 1.2.2.41 src/gtk/filesel.c;  ) > 3.7.6cvs13.patchset
 ( cvs diff -u -r 1.274.2.310 -r 1.274.2.311 src/mainwindow.c;  ) > 3.7.6cvs14.patchset
 ( cvs diff -u -r 1.39.2.57 -r 1.39.2.58 src/mainwindow.h;  cvs diff -u -r 1.274.2.311 -r 1.274.2.312 src/mainwindow.c;  ) > 3.7.6cvs15.patchset
+( cvs diff -u -r 1.274.2.312 -r 1.274.2.313 src/mainwindow.c;  cvs diff -u -r 1.1.2.93 -r 1.1.2.94 src/gtk/quicksearch.c;  ) > 3.7.6cvs16.patchset
index 8445d61..0f9b1e9 100644 (file)
@@ -12,7 +12,7 @@ MINOR_VERSION=7
 MICRO_VERSION=6
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=15
+EXTRA_VERSION=16
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 6443aa9..f68408f 100644 (file)
@@ -573,6 +573,31 @@ static gboolean search_condition_expr(GtkMenuItem *widget, gpointer data)
        return TRUE;
 };
 
+static void quicksearch_set_button(GtkButton *button, const gchar *icon, const gchar *text)
+{
+       GList *children = gtk_container_get_children(GTK_CONTAINER(button));
+       GList *cur;
+       GtkWidget *box;
+       gboolean icon_visible;
+
+       g_object_get(gtk_settings_get_default(), 
+                                        "gtk-button-images", &icon_visible, 
+                                        NULL);
+
+       for (cur = children; cur; cur = cur->next)
+               gtk_container_remove(GTK_CONTAINER(button), GTK_WIDGET(cur->data));
+       
+       g_list_free(children);
+       box = gtk_hbox_new(FALSE, 0);
+       
+       gtk_container_add(GTK_CONTAINER(button), box);
+       if (icon_visible || !text || !*text)
+               gtk_box_pack_start(GTK_BOX(box), gtk_image_new_from_stock(icon, 
+                       GTK_ICON_SIZE_BUTTON), FALSE, FALSE, 0);
+       gtk_box_pack_start(GTK_BOX(box), gtk_label_new_with_mnemonic(text), FALSE, FALSE, 0);
+       gtk_widget_show_all(box);
+}
+
 QuickSearch *quicksearch_new()
 {
        QuickSearch *quicksearch;
@@ -757,6 +782,10 @@ QuickSearch *quicksearch_new()
        quicksearch->press_timeout_id = -1;
        quicksearch->normal_search_strings = NULL;
        quicksearch->extended_search_strings = NULL;
+
+       quicksearch_set_button(GTK_BUTTON(quicksearch->search_description), GTK_STOCK_INFO, _("_Information"));
+       quicksearch_set_button(GTK_BUTTON(quicksearch->search_condition_expression), GTK_STOCK_EDIT, _("_Edit"));
+       quicksearch_set_button(GTK_BUTTON(quicksearch->clear_search), GTK_STOCK_CLEAR, _("_Clear"));
        
        update_extended_buttons(quicksearch);
 
@@ -769,21 +798,14 @@ void quicksearch_relayout(QuickSearch *quicksearch)
        case NORMAL_LAYOUT:
        case WIDE_LAYOUT:
        case WIDE_MSGLIST_LAYOUT:
-               gtk_button_set_label(GTK_BUTTON(quicksearch->search_description), GTK_STOCK_INFO);
-               gtk_button_set_label(GTK_BUTTON(quicksearch->search_condition_expression), GTK_STOCK_EDIT);
-               gtk_button_set_label(GTK_BUTTON(quicksearch->clear_search), GTK_STOCK_CLEAR);
+               quicksearch_set_button(GTK_BUTTON(quicksearch->search_description), GTK_STOCK_INFO, _("_Information"));
+               quicksearch_set_button(GTK_BUTTON(quicksearch->search_condition_expression), GTK_STOCK_EDIT, _("_Edit"));
+               quicksearch_set_button(GTK_BUTTON(quicksearch->clear_search), GTK_STOCK_CLEAR, _("_Clear"));
                break;
        case VERTICAL_LAYOUT:
-               gtk_button_set_label(GTK_BUTTON(quicksearch->search_description), "");
-               gtk_button_set_label(GTK_BUTTON(quicksearch->search_condition_expression), "");
-               gtk_button_set_label(GTK_BUTTON(quicksearch->clear_search), "");
-
-               gtk_button_set_image(GTK_BUTTON(quicksearch->search_description),
-                       gtk_image_new_from_stock(GTK_STOCK_INFO, GTK_ICON_SIZE_BUTTON));
-               gtk_button_set_image(GTK_BUTTON(quicksearch->search_condition_expression),
-                       gtk_image_new_from_stock(GTK_STOCK_EDIT, GTK_ICON_SIZE_BUTTON));
-               gtk_button_set_image(GTK_BUTTON(quicksearch->clear_search),
-                       gtk_image_new_from_stock(GTK_STOCK_CLEAR, GTK_ICON_SIZE_BUTTON));
+               quicksearch_set_button(GTK_BUTTON(quicksearch->search_description), GTK_STOCK_INFO, "");
+               quicksearch_set_button(GTK_BUTTON(quicksearch->search_condition_expression), GTK_STOCK_EDIT, "");
+               quicksearch_set_button(GTK_BUTTON(quicksearch->clear_search), GTK_STOCK_CLEAR, "");
                break;
        }
 }
index 8c57ebe..c7cb2de 100644 (file)
@@ -1540,10 +1540,6 @@ MainWindow *main_window_create()
        debug_print("Creating main window...\n");
        mainwin = g_new0(MainWindow, 1);
 
-       g_object_get(gtk_settings_get_default(), 
-                                "gtk-button-images", &mainwin->button_images, 
-                                NULL);
-
        /* main window */
        window = GTK_WIDGET(gtkut_window_new(GTK_WINDOW_TOPLEVEL, "mainwindow"));
        gtk_window_set_title(GTK_WINDOW(window), PROG_VERSION);
@@ -3661,23 +3657,6 @@ static void main_window_set_widgets(MainWindow *mainwin, LayoutType layout_mode)
 
        cm_menu_set_sensitive_full(mainwin->ui_manager, "Menu/View/ShowHide/MessageView", 
                (layout_mode != WIDE_MSGLIST_LAYOUT && layout_mode != SMALL_LAYOUT));
-       if (!mainwin->button_images) {
-               gboolean button_images = FALSE;
-               g_object_get(gtk_settings_get_default(), 
-                                        "gtk-button-images", &button_images, 
-                                        NULL);
-               if ((layout_mode == VERTICAL_LAYOUT || layout_mode == SMALL_LAYOUT) &&
-                       !button_images) {
-                       button_images = TRUE;
-                       g_object_set(gtk_settings_get_default(), "gtk-button-images",
-                                                TRUE, NULL);
-               }
-               else if(button_images) {
-                       button_images = FALSE;
-                       g_object_set(gtk_settings_get_default(), "gtk-button-images",
-                                                FALSE, NULL);
-               }
-       }
        switch (layout_mode) {
        case VERTICAL_LAYOUT:
        case NORMAL_LAYOUT: