2004-11-30 [colin] 0.9.12cvs177.1
authorColin Leroy <colin@colino.net>
Tue, 30 Nov 2004 10:35:15 +0000 (10:35 +0000)
committerColin Leroy <colin@colino.net>
Tue, 30 Nov 2004 10:35:15 +0000 (10:35 +0000)
* src/gtk/prefswindow.c
* src/gtk/pluginwindow.c
Sync with HEAD

ChangeLog-gtk2.claws
PATCHSETS
configure.ac
src/gtk/pluginwindow.c
src/gtk/prefswindow.c

index f8c48bf779dce045e5aea2ca73bf7cc65d2ca180..03d5a2a7a0ae784f7ab72207fd8cf865920706c6 100644 (file)
@@ -1,3 +1,9 @@
+2004-11-30 [colin]     0.9.12cvs177.1
+
+       * src/gtk/prefswindow.c
+       * src/gtk/pluginwindow.c
+               Sync with HEAD
+
 2004-11-29 [colin]     0.9.12cvs176.1
 
        * src/folderview.c
index 85d1faf2ef2f00bc5926c53d52b1c618a3818e60..a7fd7741da1e19149b83b88364b2c9cbb6fad091 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.56.2.28 -r 1.56.2.29 src/pop.c; ) > 0.9.12cvs174.1.patchset
 ( cvs diff -u -r 1.49.2.23 -r 1.49.2.24 src/procmime.c; ) > 0.9.12cvs175.1.patchset
 ( cvs diff -u -r 1.207.2.22 -r 1.207.2.23 src/folderview.c; ) > 0.9.12cvs176.1.patchset
+( cvs diff -u -r 1.12.2.8 -r 1.12.2.9 src/gtk/prefswindow.c; cvs diff -u -r 1.5.2.6 -r 1.5.2.7 src/gtk/pluginwindow.c; ) > 0.9.12cvs177.1.patchset
index a12560c9a8a47e821c01965b05d0e83e2c7984ee..39d57cb7b8dd2fc3fa0a54427535f796684b3f85 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=12
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=176
+EXTRA_VERSION=177
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=.1
 
index 46f4887debd2d6f864d32fad36407dd670b4be5e..52f075966c785f2134e548251dc0c16244515bd5 100644 (file)
@@ -24,6 +24,7 @@
 #include <string.h>
 
 #include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
 
 #include "intl.h"
 #include "plugin.h"
@@ -58,7 +59,7 @@ static void set_plugin_list(PluginWindow *pluginwindow)
        GtkCList *clist = GTK_CLIST(pluginwindow->plugin_list);
        GtkTextBuffer *textbuf;
        GtkTextIter start_iter, end_iter;
-       
+
        plugins = plugin_get_list();
        gtk_clist_freeze(clist);
        gtk_clist_clear(clist);
@@ -67,15 +68,17 @@ static void set_plugin_list(PluginWindow *pluginwindow)
        gtk_text_buffer_get_end_iter(textbuf, &end_iter);
        gtk_text_buffer_delete(textbuf, &start_iter, &end_iter);
        gtk_widget_set_sensitive(pluginwindow->unload_btn, FALSE);
-       
+
        for(cur = plugins; cur != NULL; cur = g_slist_next(cur)) {
                Plugin *plugin = (Plugin *) cur->data;
-               
+
                text[0] = (gchar *) plugin_get_name(plugin);
                row = gtk_clist_append(clist, text);
                gtk_clist_set_row_data(clist, row, plugin);
        }
        gtk_clist_thaw(clist);
+       if (pluginwindow->selected_plugin == NULL)
+               gtk_clist_select_row (clist, 0, -1);
 }
 
 static void select_row_cb(GtkCList *clist, gint row, gint column,
@@ -86,7 +89,7 @@ static void select_row_cb(GtkCList *clist, gint row, gint column,
        GtkTextBuffer *textbuf = gtk_text_view_get_buffer(plugin_desc);
        GtkTextIter start_iter, end_iter;
        const gchar *text;
-       
+
        plugin = (Plugin *) gtk_clist_get_row_data(clist, row);
        pluginwindow->selected_plugin = plugin;
 
@@ -111,9 +114,10 @@ static void unselect_row_cb(GtkCList * clist, gint row, gint column,
 static void unload_cb(GtkButton *button, PluginWindow *pluginwindow)
 {
        Plugin *plugin = pluginwindow->selected_plugin;
-       
+
        g_return_if_fail(plugin != NULL);
        plugin_unload(plugin);
+       pluginwindow->selected_plugin = NULL;
        set_plugin_list(pluginwindow);
 }
 
@@ -134,6 +138,34 @@ static void load_cb(GtkButton *button, PluginWindow *pluginwindow)
        set_plugin_list(pluginwindow);          
 }
 
+static void pluginwindow_key_pressed(GtkWidget *widget, GdkEventKey *event,
+                                    PluginWindow *pluginwindow)
+{
+       if (event) {
+               switch (event->keyval) {
+                       case GDK_Escape : 
+                       case GDK_Return : 
+                       case GDK_KP_Enter :
+                               close_cb(NULL, pluginwindow);
+                               break;
+                       case GDK_Insert : 
+                       case GDK_KP_Insert :
+                       case GDK_KP_Add : 
+                       case GDK_plus :
+                               load_cb(NULL, pluginwindow);
+                               break;
+                       case GDK_Delete : 
+                       case GDK_KP_Delete :
+                       case GDK_KP_Subtract : 
+                       case GDK_minus :
+                               unload_cb(NULL, pluginwindow);
+                               break;
+                       default :
+                               break;
+               }
+       }
+}
+
 void pluginwindow_create()
 {
        PluginWindow *pluginwindow;
@@ -180,6 +212,8 @@ void pluginwindow_create()
        gtk_container_add(GTK_CONTAINER(scrolledwindow2), plugin_list);
        gtk_clist_set_column_width(GTK_CLIST(plugin_list), 0, 80);
        gtk_clist_column_titles_show(GTK_CLIST(plugin_list));
+       gtk_clist_set_selection_mode(GTK_CLIST (plugin_list), GTK_SELECTION_BROWSE);
+       gtk_widget_grab_focus(GTK_WIDGET(plugin_list));
 
        label12 = gtk_label_new(_("Plugins"));
        gtk_widget_show(label12);
@@ -250,6 +284,8 @@ void pluginwindow_create()
                         G_CALLBACK(select_row_cb), pluginwindow);
        g_signal_connect(G_OBJECT(plugin_list), "unselect-row",
                         G_CALLBACK(unselect_row_cb), pluginwindow);
+       g_signal_connect(G_OBJECT(window), "key_press_event",
+                          G_CALLBACK(pluginwindow_key_pressed), pluginwindow);
 
        pluginwindow->window = window;
        pluginwindow->plugin_list = plugin_list;
index 5945bde8deb5ebf8b456e047cf2d17dbaac345bd..1813790a538f5b3077f19d90496f7c503dbae9b9 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <string.h>
 #include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
 
 #include "intl.h"
 #include "utils.h"
@@ -92,7 +93,7 @@ static gboolean ctree_select_row(GtkCTree *ctree, GList *node, gint column, gpoi
        while (page->path[i + 1] != 0)
                i++;
        labeltext = page->path[i];
-       
+
        gtk_label_set_text(GTK_LABEL(prefswindow->pagelabel), labeltext);
 
        pagenum = gtk_notebook_page_num(GTK_NOTEBOOK(prefswindow->notebook),
@@ -204,6 +205,24 @@ gint compare_func(GtkCList *clist, gconstpointer ptr1, gconstpointer ptr2)
                                                                  0;
 }
 
+static void prefswindow_key_pressed(GtkWidget *widget, GdkEventKey *event,
+                                   gpointer data)
+{
+       if (event) {
+               switch (event->keyval) {
+                       case GDK_Escape :
+                               cancel_button_released(NULL, data);
+                               break;
+                       case GDK_Return : 
+                       case GDK_KP_Enter :
+                               ok_button_released(NULL, data);
+                               break;
+                       default:
+                               break;
+               }
+       }
+}
+
 void prefswindow_open_full(const gchar *title, GSList *prefs_pages, gpointer data, GtkDestroyNotify func)
 {
        static gchar *titles[1];
@@ -321,6 +340,7 @@ void prefswindow_open_full(const gchar *title, GSList *prefs_pages, gpointer dat
        gtk_clist_set_column_max_width(GTK_CLIST(prefswindow->ctree), 0, optsize);
        gtk_clist_set_compare_func(GTK_CLIST(prefswindow->ctree), compare_func);
        gtk_ctree_sort_recursive(GTK_CTREE(prefswindow->ctree), NULL);
+       gtk_widget_grab_focus(GTK_WIDGET(prefswindow->ctree));
 
        gtkut_button_set_create(&prefswindow->confirm_area,
                                &prefswindow->ok_btn,           _("OK"),
@@ -339,6 +359,8 @@ void prefswindow_open_full(const gchar *title, GSList *prefs_pages, gpointer dat
                         G_CALLBACK(apply_button_released), prefswindow);
        g_signal_connect(G_OBJECT(prefswindow->window), "delete_event", 
                         G_CALLBACK(window_closed), prefswindow);
+       g_signal_connect(G_OBJECT(prefswindow->window), "key_press_event",
+                          G_CALLBACK(prefswindow_key_pressed), &(prefswindow->window));
 
        gtk_widget_show(prefswindow->window);
 }
@@ -347,4 +369,3 @@ void prefswindow_open(const gchar *title, GSList *prefs_pages, gpointer data)
 {
        prefswindow_open_full(title, prefs_pages, data, NULL);
 }
-