Add keyboard shortcuts to pluginwindow Load.../Unload buttons.
[claws.git] / src / gtk / pluginwindow.c
index a84a76a1b6639b22d8786f15ba784e9ee9d6bda4..87acdd802b5e01c7115f0b2a9f53c682d66fd0ab 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2009 Hiroyuki Yamamoto and the Claws Mail Team
+ * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2015 Hiroyuki Yamamoto and the Claws Mail Team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  *
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * 
  */
 
 #ifdef HAVE_CONFIG_H
 #  include "config.h"
+#include "claws-features.h"
 #endif
 
 #include <glib.h>
@@ -212,7 +212,7 @@ static void load_cb(GtkButton *button, PluginWindow *pluginwindow)
                        if (error != NULL) {
                                gchar *basename = g_path_get_basename(file);
                                alertpanel_error(
-                               _("The following error occurred while loading %s :\n\n%s\n"),
+                               _("The following error occurred while loading %s:\n\n%s\n"),
                                basename, error);
                                g_free(basename);
                                g_free(error);
@@ -232,21 +232,21 @@ static gboolean pluginwindow_key_pressed(GtkWidget *widget, GdkEventKey *event,
 {
        if (event) {
                switch (event->keyval) {
-                       case GDK_Escape : 
-                       case GDK_Return : 
-                       case GDK_KP_Enter :
+                       case GDK_KEY_Escape : 
+                       case GDK_KEY_Return : 
+                       case GDK_KEY_KP_Enter :
                                close_cb(NULL, pluginwindow);
                                break;
-                       case GDK_Insert : 
-                       case GDK_KP_Insert :
-                       case GDK_KP_Add : 
-                       case GDK_plus :
+                       case GDK_KEY_Insert : 
+                       case GDK_KEY_KP_Insert :
+                       case GDK_KEY_KP_Add : 
+                       case GDK_KEY_plus :
                                load_cb(NULL, pluginwindow);
                                break;
-                       case GDK_Delete : 
-                       case GDK_KP_Delete :
-                       case GDK_KP_Subtract : 
-                       case GDK_minus :
+                       case GDK_KEY_Delete : 
+                       case GDK_KEY_KP_Delete :
+                       case GDK_KEY_KP_Subtract : 
+                       case GDK_KEY_minus :
                                unload_cb(NULL, pluginwindow);
                                break;
                        default :
@@ -288,12 +288,11 @@ void pluginwindow_create()
        GtkWidget *load_btn;
        GtkWidget *unload_btn;
        GtkWidget *close_btn;
-       GtkWidget *get_more_btn;
+       gchar *markup, *span;
        GtkWidget *desc_lbl;
        GtkWidget *vbox3;
        GtkWidget *hbox_info;
        static GdkGeometry geometry;
-       CLAWS_TIP_DECL();       
 
        debug_print("Creating plugins window...\n");
 
@@ -334,8 +333,8 @@ void pluginwindow_create()
        gtk_widget_grab_focus(GTK_WIDGET(plugin_list_view));
 
        gtkut_stock_button_set_create(&hbuttonbox1,
-                               &load_btn, _("Load..."),
-                               &unload_btn, _("Unload"),
+                               &load_btn, _("_Load..."),
+                               &unload_btn, _("_Unload"),
                                NULL, NULL);
        gtk_widget_show(hbuttonbox1);
        gtk_box_pack_start(GTK_BOX(vbox3), hbuttonbox1, FALSE, FALSE, 0);
@@ -370,16 +369,17 @@ void pluginwindow_create()
        hbox_info = gtk_hbox_new(FALSE, 5);
        gtk_widget_show(hbox_info);
        
-       desc_lbl = gtk_label_new(_("More plugins are available from the "
-                                  "Claws Mail website."));
+       desc_lbl = gtk_label_new("");
+       span = g_strdup_printf("<a href=\"%s\"><span underline=\"none\">", PLUGINS_URI);
+       markup = g_strdup_printf(_("For more information about plugins see the "
+                                          "%sClaws Mail website%s."), span, "</span></a>");
+       gtk_label_set_markup(GTK_LABEL(desc_lbl), markup);
+       g_free(markup);
+       g_free(span);
        gtk_misc_set_alignment(GTK_MISC(desc_lbl), 0, 0.5);
        gtk_widget_show(desc_lbl);
        gtk_box_pack_start(GTK_BOX(hbox_info), desc_lbl, FALSE, FALSE, 0);
 
-       get_more_btn = gtkut_get_link_btn(window, PLUGINS_URI, _("Get more..."));
-       gtk_misc_set_alignment(GTK_MISC(gtk_bin_get_child(GTK_BIN((get_more_btn)))), 0, 0.5);
-       gtk_widget_show(get_more_btn);
-       gtk_box_pack_start(GTK_BOX(hbox_info), get_more_btn, FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox_info), gtk_label_new(""), TRUE, TRUE, 0);
        gtk_box_pack_start(GTK_BOX(vbox1), hbox_info, FALSE, FALSE, 0);
 
@@ -409,6 +409,7 @@ void pluginwindow_create()
                           G_CALLBACK(pluginwindow_key_pressed), pluginwindow);
        g_signal_connect(G_OBJECT(window), "delete_event",
                         G_CALLBACK(pluginwindow_delete_cb), pluginwindow);
+       MANAGE_WINDOW_SIGNALS_CONNECT(window);
 
        CLAWS_SET_TIP(load_btn,
                        _("Click here to load one or more plugins"));