2007-06-10 [wwp] 2.9.2cvs51
[claws.git] / src / gtk / pluginwindow.c
index 7a7d8b3c204a611e8626191728a2f251316a3a8a..58810a73207215aafda4ff52e12f3e5e31d6fc61 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2006 Hiroyuki Yamamoto and the Sylpheed-Claws Team
+ * Copyright (C) 1999-2007 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
@@ -36,6 +36,7 @@
 #include "prefs_common.h"
 #include "../inc.h"
 #include "manual.h"
+#include "manage_window.h"
 
 enum {
        PLUGINWINDOW_NAME,              /*<! plugin name */
@@ -71,6 +72,13 @@ static void close_cb(GtkButton *button, PluginWindow *pluginwindow)
        inc_unlock();
 }
 
+static gint pluginwindow_delete_cb(GtkWidget *widget, GdkEventAny *event,
+                                 PluginWindow *pluginwindow)
+{
+       close_cb(NULL,pluginwindow);
+       return TRUE;
+}
+
 static void set_plugin_list(PluginWindow *pluginwindow)
 {
        GSList *plugins, *cur, *unloaded;
@@ -182,7 +190,7 @@ static void load_cb(GtkButton *button, PluginWindow *pluginwindow)
        GList *file_list;
 
        file_list = filesel_select_multiple_files_open_with_filter(
-                       _("Select Plugin to load"), get_plugin_dir(), 
+                       _("Select the Plugins to load"), get_plugin_dir(), 
                        "*." G_MODULE_SUFFIX);
 
        if (file_list) {
@@ -195,9 +203,11 @@ static void load_cb(GtkButton *button, PluginWindow *pluginwindow)
                        if (!file) continue;
                        plugin_load(file, &error);
                        if (error != NULL) {
+                               gchar *basename = g_path_get_basename(file);
                                alertpanel_error(
-                               _("The following error occured while loading the plugin [%s] :\n%s\n"),
-                               file, error);
+                               _("The following error occured while loading %s :\n\n%s\n"),
+                               basename, error);
+                               g_free(basename);
                                g_free(error);
                        }
 
@@ -255,7 +265,6 @@ static void pluginwindow_size_allocate_cb(GtkWidget *widget,
 void pluginwindow_create()
 {
        PluginWindow *pluginwindow;
-       /* ---------------------- code made by glade ---------------------- */
        GtkWidget *window;
        GtkWidget *vbox1;
        GtkWidget *hbox2;
@@ -266,26 +275,31 @@ void pluginwindow_create()
        GtkWidget *label13;
        GtkWidget *scrolledwindow3;
        GtkWidget *plugin_desc;
-       GtkWidget *hbuttonbox1, *hbox3;
+       GtkWidget *hbuttonbox1;
        GtkWidget *help_btn;
        GtkWidget *load_btn;
        GtkWidget *unload_btn;
        GtkWidget *close_btn;
        GtkWidget *get_more_btn;
+       GtkWidget *desc_lbl;
        static GdkGeometry geometry;
+       GtkTooltips *tooltips;
        
        debug_print("Creating plugins window...\n");
 
        pluginwindow = g_new0(PluginWindow, 1);
 
-       window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+       window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "pluginwindow");
        gtk_container_set_border_width(GTK_CONTAINER(window), 8);
        gtk_window_set_title(GTK_WINDOW(window), _("Plugins"));
        gtk_window_set_modal(GTK_WINDOW(window), TRUE);
+       manage_window_set_transient(GTK_WINDOW(window));
 
        vbox1 = gtk_vbox_new(FALSE, 4);
        gtk_widget_show(vbox1);
        gtk_container_add(GTK_CONTAINER(window), vbox1);
+       gtk_box_set_homogeneous(GTK_BOX(vbox1), FALSE);
+       gtk_widget_realize(window);
 
        hbox2 = gtk_hbox_new(FALSE, 8);
        gtk_widget_show(hbox2);
@@ -328,27 +342,24 @@ void pluginwindow_create()
        gtk_widget_show(plugin_desc);
        gtk_container_add(GTK_CONTAINER(scrolledwindow3), plugin_desc);
 
-       hbox3 = gtk_hbox_new(FALSE, 0);
-       gtk_widget_show(hbox3);
-       hbuttonbox1 = gtk_hbutton_box_new();
-       gtk_widget_show(hbuttonbox1);
+       desc_lbl = gtk_label_new(_("More plugins are available from the "
+                                  "Claws Mail website."));
+       gtk_misc_set_alignment(GTK_MISC(desc_lbl), 0, 0.5);
+       gtk_widget_show(desc_lbl);
+       gtk_box_pack_start(GTK_BOX(vbox1), desc_lbl, FALSE, FALSE, 0);
 
-       gtk_widget_realize(window);
        get_more_btn = gtkut_get_link_btn(window, PLUGINS_URI, _("Get more..."));
        gtk_misc_set_alignment(GTK_MISC(GTK_BIN(get_more_btn)->child), 0, 0.5);
        gtk_widget_show(get_more_btn);
-
-       gtk_box_pack_start(GTK_BOX(hbox3), get_more_btn, TRUE, TRUE, 0);
-       gtk_box_pack_start(GTK_BOX(hbox3), hbuttonbox1, FALSE, FALSE, 0);
-       gtk_box_pack_start(GTK_BOX(vbox1), hbox3, FALSE, FALSE, 0);
+       gtk_box_pack_start(GTK_BOX(vbox1), get_more_btn, FALSE, FALSE, 0);
 
        gtkut_stock_button_set_create_with_help(&hbuttonbox1, &help_btn,
                        &load_btn, _("Load Plugin..."),
                        &unload_btn, _("Unload Plugin"),
                        &close_btn, GTK_STOCK_CLOSE);
-       gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbuttonbox1), 6);
+       gtk_box_set_spacing(GTK_BOX(hbuttonbox1), 6);
        gtk_widget_show(hbuttonbox1);
-       gtk_box_pack_end (GTK_BOX (hbox3), hbuttonbox1, FALSE, FALSE, 0);
+       gtk_box_pack_end(GTK_BOX(vbox1), hbuttonbox1, FALSE, FALSE, 0);
 
        gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(plugin_desc), GTK_WRAP_WORD);
        gtk_widget_set_sensitive(GTK_WIDGET(unload_btn), FALSE);
@@ -366,6 +377,18 @@ void pluginwindow_create()
                         G_CALLBACK(pluginwindow_size_allocate_cb), NULL);
        g_signal_connect(G_OBJECT(window), "key_press_event",
                           G_CALLBACK(pluginwindow_key_pressed), pluginwindow);
+       g_signal_connect(G_OBJECT(window), "delete_event",
+                        G_CALLBACK(pluginwindow_delete_cb), pluginwindow);
+
+       tooltips = gtk_tooltips_new();
+
+       gtk_tooltips_set_tip(GTK_TOOLTIPS(tooltips),
+                       load_btn,
+                       _("Click here to load one or more plugins"), NULL);
+
+       gtk_tooltips_set_tip(GTK_TOOLTIPS(tooltips),
+                       unload_btn,
+                       _("Unload the selected plugin"), NULL);
 
        pluginwindow->window = window;
        pluginwindow->plugin_list_view = plugin_list_view;
@@ -409,7 +432,7 @@ static GtkWidget *pluginwindow_list_view_create(PluginWindow *pluginwindow)
        list_view = GTK_TREE_VIEW(gtk_tree_view_new_with_model(model));
        g_object_unref(model);  
 
-       gtk_tree_view_set_rules_hint(list_view, prefs_common.enable_rules_hint);
+       gtk_tree_view_set_rules_hint(list_view, prefs_common.use_stripes_everywhere);
        gtk_tree_view_set_search_column (list_view, 0);
 
        selector = gtk_tree_view_get_selection(list_view);
@@ -430,7 +453,7 @@ static void pluginwindow_create_list_view_columns(GtkWidget *list_view)
 
        renderer = gtk_cell_renderer_text_new();
        column = gtk_tree_view_column_new_with_attributes
-               (_("Plugins"),
+               (_("Loaded plugins"),
                 renderer,
                 "text", PLUGINWINDOW_NAME,
                 "style", PLUGINWINDOW_STYLE,