managesieve: remove dialog hint
[claws.git] / src / plugins / managesieve / sieve_manager.c
index 212c30a1fbb97bec61f52c09fdf31281fb0f75f9..199dbba95b05c2109f7fcd1aaf60922efdc48bdc 100644 (file)
@@ -67,7 +67,6 @@ typedef struct {
 } CommandDataGetScript;
 
 static void account_changed(GtkWidget *widget, SieveManagerPage *page);
-static void filter_activate(GtkWidget *widget, SieveManagerPage *page);
 void sieve_manager_close(GtkWidget *widget, SieveManagerPage *page);
 static void filter_set_active(SieveManagerPage *page, gchar *filter_name);
 gboolean filter_find_by_name (GtkTreeModel *model, GtkTreeIter *iter,
@@ -290,17 +289,6 @@ static void sieve_set_active_filter(SieveManagerPage *page, gchar *filter_name)
                        (sieve_session_data_cb_fn)filter_activated, cmd_data);
 }
 
-/*
- * activate button clicked
- */
-static void filter_activate(GtkWidget *widget, SieveManagerPage *page)
-{
-       gchar *filter_name = filters_list_get_selected_filter(page->filters_list);
-       if (!filter_name)
-               return;
-       sieve_set_active_filter(page, filter_name);
-}
-
 static void filter_deleted(SieveSession *session, const gchar *err_msg,
                CommandDataName *cmd_data)
 {
@@ -547,6 +535,14 @@ static gboolean manager_key_pressed(GtkWidget *widget, GdkEventKey *event,
        return FALSE;
 }
 
+static void size_allocate_cb(GtkWidget *widget, GtkAllocation *allocation)
+{
+       cm_return_if_fail(allocation != NULL);
+
+       sieve_config.manager_win_width = allocation->width;
+       sieve_config.manager_win_height = allocation->height;
+}
+
 static void got_session_error(SieveSession *session, const gchar *msg,
                SieveManagerPage *page)
 {
@@ -626,7 +622,7 @@ static SieveManagerPage *sieve_manager_page_new()
 {
        SieveManagerPage *page;
        GtkWidget *window;
-       GtkWidget *hbox, *vbox, *vbox_allbuttons, *vbox_buttons;
+       GtkWidget *hbox, *vbox, *vbox_buttons;
        GtkWidget *accounts_menu;
        GtkWidget *label;
        GtkWidget *scrolledwin;
@@ -640,6 +636,8 @@ static SieveManagerPage *sieve_manager_page_new()
        SieveAccountConfig *config;
        PrefsAccount *default_account = NULL;
 
+       static GdkGeometry geometry;
+
        page = g_new0(SieveManagerPage, 1);
 
        /* Manage Window */
@@ -647,10 +645,22 @@ static SieveManagerPage *sieve_manager_page_new()
        window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "sievemanager");
        gtk_container_set_border_width (GTK_CONTAINER (window), 8);
        gtk_window_set_title (GTK_WINDOW (window), _("Manage Sieve Filters"));
-       gtk_widget_set_size_request (window, 480, 296);
        MANAGE_WINDOW_SIGNALS_CONNECT (window);
+
        g_signal_connect (G_OBJECT (window), "key_press_event",
                        G_CALLBACK (manager_key_pressed), page);
+       g_signal_connect (G_OBJECT(window), "size_allocate",
+                        G_CALLBACK (size_allocate_cb), NULL);
+
+       if (!geometry.min_height) {
+               geometry.min_width = 350;
+               geometry.min_height = 280;
+       }
+
+       gtk_window_set_geometry_hints(GTK_WINDOW(window), NULL, &geometry,
+                                     GDK_HINT_MIN_SIZE);
+       gtk_widget_set_size_request(window, sieve_config.manager_win_width,
+                       sieve_config.manager_win_height);
 
        vbox = gtk_vbox_new (FALSE, 10);
        gtk_container_add (GTK_CONTAINER (window), vbox);
@@ -709,47 +719,37 @@ static SieveManagerPage *sieve_manager_page_new()
 
        /* Buttons */
 
-       vbox_allbuttons = gtk_vbox_new (FALSE, 0);
-       gtk_box_pack_start (GTK_BOX (hbox), vbox_allbuttons, FALSE, FALSE, 0);
-
-       vbox_buttons = gtk_vbox_new (FALSE, 0);
+       vbox_buttons = gtk_vbox_new (FALSE, 8);
        gtk_widget_set_sensitive(vbox_buttons, FALSE);
-       gtk_box_pack_start (GTK_BOX (vbox_allbuttons), vbox_buttons, FALSE, FALSE, 0);
+       gtk_box_pack_start (GTK_BOX (hbox), vbox_buttons, FALSE, FALSE, 0);
 
        /* new */
        btn = gtk_button_new_from_stock(GTK_STOCK_NEW);
-       gtk_box_pack_start (GTK_BOX (vbox_buttons), btn, FALSE, FALSE, 4);
+       gtk_box_pack_start (GTK_BOX (vbox_buttons), btn, FALSE, FALSE, 0);
        g_signal_connect (G_OBJECT(btn), "clicked",
                          G_CALLBACK (filter_add), page);
 
        /* edit */
        btn = gtk_button_new_from_stock (GTK_STOCK_EDIT);
-       gtk_box_pack_start (GTK_BOX (vbox_buttons), btn, FALSE, FALSE, 4);
+       gtk_box_pack_start (GTK_BOX (vbox_buttons), btn, FALSE, FALSE, 0);
        g_signal_connect (G_OBJECT(btn), "clicked",
                        G_CALLBACK (filter_edit), page);
 
        /* delete */
        btn = gtk_button_new_from_stock(GTK_STOCK_DELETE);
-       gtk_box_pack_start (GTK_BOX (vbox_buttons), btn, FALSE, FALSE, 4);
+       gtk_box_pack_start (GTK_BOX (vbox_buttons), btn, FALSE, FALSE, 0);
        g_signal_connect (G_OBJECT(btn), "clicked",
                        G_CALLBACK (filter_delete), page);
 
        /* rename */
        btn = gtk_button_new_with_label("Rename");
-       gtk_box_pack_start (GTK_BOX (vbox_buttons), btn, FALSE, FALSE, 4);
+       gtk_box_pack_start (GTK_BOX (vbox_buttons), btn, FALSE, FALSE, 0);
        g_signal_connect (G_OBJECT(btn), "clicked",
                        G_CALLBACK (filter_rename), page);
 
-
-       /* activate */
-       btn = gtk_button_new_with_label("Activate");
-       gtk_box_pack_start (GTK_BOX (vbox_buttons), btn, FALSE, FALSE, 4);
-       g_signal_connect (G_OBJECT(btn), "clicked",
-                       G_CALLBACK (filter_activate), page);
-
        /* refresh */
-       btn = gtk_button_new_with_mnemonic("_Refresh");
-       gtk_box_pack_start (GTK_BOX (vbox_allbuttons), btn, FALSE, FALSE, 4);
+       btn = gtk_button_new_from_stock(GTK_STOCK_REFRESH);
+       gtk_box_pack_end (GTK_BOX (vbox_buttons), btn, FALSE, FALSE, 0);
        g_signal_connect (G_OBJECT(btn), "clicked",
                        G_CALLBACK (account_changed), page);