aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVivek Jain <jvivek@novell.com>2005-07-07 17:02:29 +0800
committerJain Vivek <jvivek@src.gnome.org>2005-07-07 17:02:29 +0800
commit832ce2665394262b1035ec55c6407cd33d220e20 (patch)
tree398319e56e86870b5174621879b27c396affe982
parent92841e59f4d84c832d27c45e306d00bc79daaaf2 (diff)
downloadgsoc2013-evolution-832ce2665394262b1035ec55c6407cd33d220e20.tar
gsoc2013-evolution-832ce2665394262b1035ec55c6407cd33d220e20.tar.gz
gsoc2013-evolution-832ce2665394262b1035ec55c6407cd33d220e20.tar.bz2
gsoc2013-evolution-832ce2665394262b1035ec55c6407cd33d220e20.tar.lz
gsoc2013-evolution-832ce2665394262b1035ec55c6407cd33d220e20.tar.xz
gsoc2013-evolution-832ce2665394262b1035ec55c6407cd33d220e20.tar.zst
gsoc2013-evolution-832ce2665394262b1035ec55c6407cd33d220e20.zip
added: junk-mail-settings.c junk-settings.c junk-settings.h
2005-07-07 Vivek Jain <jvivek@novell.com> added: junk-mail-settings.c junk-settings.c junk-settings.h junk-settings.glade , for displaying/maipulating junk mail settings svn path=/trunk/; revision=29664
-rw-r--r--plugins/groupwise-features/junk-mail-settings.c146
-rw-r--r--plugins/groupwise-features/junk-settings.c437
-rw-r--r--plugins/groupwise-features/junk-settings.glade494
-rw-r--r--plugins/groupwise-features/junk-settings.h103
4 files changed, 1180 insertions, 0 deletions
diff --git a/plugins/groupwise-features/junk-mail-settings.c b/plugins/groupwise-features/junk-mail-settings.c
new file mode 100644
index 0000000000..99008b3e01
--- /dev/null
+++ b/plugins/groupwise-features/junk-mail-settings.c
@@ -0,0 +1,146 @@
+/*
+ * Copyright (C) 2005 Novell, Inc.
+ *
+ * Author(s): Vivek Jain <jvivek@novell.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <glib/gi18n-lib.h>
+#include <string.h>
+#include <stdio.h>
+#include <gtk/gtk.h>
+
+#include "camel/camel-store.h"
+#include "camel/camel-folder.h"
+#include "camel/camel-medium.h"
+#include "camel/camel-mime-message.h"
+#include "mail/em-popup.h"
+#include <mail/em-folder-view.h>
+#include <e-gw-connection.h>
+#include "mail/em-account-editor.h"
+#include "e-util/e-account.h"
+#include "mail/em-config.h"
+#include "share-folder.h"
+#include "junk-settings.h"
+
+void
+org_gnome_junk_settings(EPlugin *ep, EMPopupTargetSelect *t);
+
+static void
+abort_changes (JunkSettings *js)
+{
+ g_object_run_dispose ((GObject *)js);
+}
+
+static void
+junk_dialog_response (GtkWidget *dialog, int response, JunkSettings *js)
+{
+ if (response == GTK_RESPONSE_ACCEPT) {
+ commit_changes(js);
+ abort_changes (js);
+ }
+ else
+ abort_changes (js);
+
+ gtk_widget_destroy (dialog);
+
+}
+
+static void
+junk_mail_settings (EPopup *ep, EPopupItem *item, void *data)
+{
+ GtkWidget *dialog ,*w, *notebook, *box;
+ JunkSettings *junk_tab;
+ int page_count =0;
+ EGwConnection *cnc;
+ CamelFolder *folder = (CamelFolder *)data;
+ CamelStore *store = folder->parent_store;
+ cnc = get_cnc (store);
+
+ dialog = gtk_dialog_new_with_buttons ("Junk Settings",
+ NULL,
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_REJECT,
+ GTK_STOCK_OK,
+ GTK_RESPONSE_ACCEPT,
+ NULL);
+ gtk_window_set_default_size ((GtkWindow *) dialog, 292, 260);
+ gtk_widget_ensure_style (dialog);
+ gtk_container_set_border_width ((GtkContainer *) ((GtkDialog *) dialog)->vbox, 12);
+ box = gtk_vbox_new (FALSE, 6);
+ w = gtk_label_new ();
+ gtk_label_set_markup (GTK_LABEL (w), "<b>Junk Mail Settings</b>");
+ gtk_box_pack_start ((GtkBox *) box, w, FALSE, FALSE, 6);
+
+ junk_tab = junk_settings_new (cnc);
+ w = junk_tab->vbox;
+ gtk_box_pack_start ((GtkBox *) box, w, FALSE, FALSE, 6);
+
+ /*We might have to add more options for settings i.e. more pages*/
+ while (page_count > 0 ){
+ notebook = gtk_notebook_new ();
+ gtk_notebook_append_page (notebook, box, NULL);
+ gtk_box_pack_start ((GtkBox *) ((GtkDialog *) dialog)->vbox, notebook, TRUE, TRUE, 0);
+ }
+
+ if (page_count == 0)
+ gtk_box_pack_start ((GtkBox *) ((GtkDialog *) dialog)->vbox, box, TRUE, TRUE, 0);
+
+ g_signal_connect (dialog, "response", G_CALLBACK (junk_dialog_response), junk_tab);
+ gtk_widget_show_all (dialog);
+}
+
+static EPopupItem popup_items[] = {
+{ E_POPUP_ITEM, "50.emfv.05", N_("Junk Mail Settings..."), junk_mail_settings, NULL, NULL, 0, EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY}
+};
+
+static void
+popup_free (EPopup *ep, GSList *items, void *data)
+{
+g_slist_free (items);
+}
+
+void
+org_gnome_junk_settings(EPlugin *ep, EMPopupTargetSelect *t)
+{
+ GSList *menus = NULL;
+
+ int i = 0;
+ static int first =1;
+
+ if (! g_strrstr (t->uri, "groupwise://"))
+ return ;
+
+ /* for translation*/
+ if (first == 1) {
+ popup_items[0].label = _(popup_items[0].label);
+
+ }
+
+ first++;
+
+ for (i = 0; i < sizeof (popup_items) / sizeof (popup_items[0]); i++)
+ menus = g_slist_prepend (menus, &popup_items[i]);
+
+ e_popup_add_items (t->target.popup, menus, NULL, popup_free, t->folder);
+
+}
+
diff --git a/plugins/groupwise-features/junk-settings.c b/plugins/groupwise-features/junk-settings.c
new file mode 100644
index 0000000000..daccf8c1c1
--- /dev/null
+++ b/plugins/groupwise-features/junk-settings.c
@@ -0,0 +1,437 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Author: Vivek Jain <jvivek@novell.com>
+ *
+ * Copyright 2005 Novell, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+#include <glade/glade.h>
+#include "junk-settings.h"
+#include <glib/gmain.h>
+#include <gtk/gtktreemodel.h>
+#include <gtk/gtkliststore.h>
+#include <gtk/gtktreeselection.h>
+#include <gtk/gtktreeview.h>
+#include <gtk/gtkdialog.h>
+#include <gtk/gtkbutton.h>
+#include <gtk/gtk.h>
+#include <gtk/gtktogglebutton.h>
+#include <gtk/gtkcellrenderertoggle.h>
+#include <gtk/gtkcellrenderertext.h>
+#include <libgnomeui/gnome-ui-init.h>
+#include <libgnome/gnome-init.h>
+#include <e-util/e-error.h>
+#include <e-gw-connection.h>
+#define ROOTNODE "vboxSettings"
+#define d(x)
+
+struct _JunkEntry {
+ EGwJunkEntry *entry;
+ int flag;
+};
+
+typedef struct _JunkEntry JunkEntry;
+
+static void junk_settings_class_init (JunkSettingsClass *class);
+static void junk_settings_init (JunkSettings *js);
+static void junk_settings_destroy (GtkObject *obj);
+static void junk_settings_finalise (GObject *obj);
+static void free_all(JunkSettings *js);
+static void get_junk_list (JunkSettings *js);
+static void disable_clicked (GtkRadioButton *button, JunkSettings *js);
+static void enable_clicked (GtkRadioButton *button, JunkSettings *js);
+GType junk_settings_get_type (void);
+
+static GtkVBoxClass *parent_class = NULL;
+
+GType
+junk_settings_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type) {
+ static const GTypeInfo info = {
+ sizeof (JunkSettingsClass),
+ NULL, NULL,
+ (GClassInitFunc) junk_settings_class_init,
+ NULL, NULL,
+ sizeof (JunkSettings),
+ 0,
+ (GInstanceInitFunc) junk_settings_init
+ };
+
+ type = g_type_register_static (gtk_vbox_get_type (), "JunkSettings", &info, 0);
+ }
+
+ return type;
+}
+
+static void
+junk_settings_class_init (JunkSettingsClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
+
+ parent_class = g_type_class_ref (gtk_vbox_get_type ());
+ object_class->destroy = junk_settings_destroy;
+ gobject_class->finalize = junk_settings_finalise;
+}
+
+static void
+junk_settings_finalise (GObject *obj)
+{
+ JunkSettings *js = (JunkSettings *) obj;
+ g_object_unref (js->xml);
+ free_all(js);
+
+ G_OBJECT_CLASS (parent_class)->finalize (obj);
+}
+
+static void
+junk_settings_destroy (GtkObject *obj)
+{
+ JunkSettings *js = (JunkSettings *) obj;
+ free_all (js);
+ GTK_OBJECT_CLASS (parent_class)->destroy (obj);
+}
+
+static void
+junk_settings_init (JunkSettings *js)
+{
+ js->users = 0;
+ js->flag_for_ok = 0;
+ js->enabled = FALSE;
+ js->junk_list = NULL;
+ js->entry_list = NULL;
+}
+
+static void
+free_entry_node(EGwJunkEntry *entry)
+{
+ if(entry){
+ g_free(entry->match);
+ entry->match = NULL;
+ }
+
+ return;
+}
+
+static void
+free_node(JunkEntry *nentry)
+{
+ EGwJunkEntry *junk_entry = nentry->entry;
+
+ if(junk_entry){
+ g_free(junk_entry->match);
+ junk_entry->match = NULL;
+ }
+
+ return;
+}
+
+static JunkEntry *
+find_node(GList *list, gchar *match)
+{
+ JunkEntry *one_entry = NULL;
+ EGwJunkEntry *ent = NULL;
+ GList *tmp;
+ gint i ;
+
+ if(list){
+ tmp = g_list_first(list);
+ for(i=0; tmp ; i++)
+ {
+ one_entry = tmp->data;
+ ent = one_entry->entry;
+ if(!g_ascii_strcasecmp(ent->match, match)){
+ return one_entry;
+ /*if found, it returns that user*/
+ }
+ tmp= g_list_next(tmp);
+ }
+ }
+
+ return NULL;
+}
+
+static void
+free_all (JunkSettings *js)
+{
+ if (js->junk_list){
+ g_list_foreach (js->junk_list,(GFunc) free_node, NULL);
+ g_list_free (js->junk_list);
+ js->junk_list = NULL;
+ }
+}
+
+static void
+get_junk_list (JunkSettings *js)
+{
+ GList *list = NULL;
+ char *entry;
+ char *msg;
+ int use_junk, use_block, use_pab, persistence;
+
+ if (E_IS_GW_CONNECTION (js->cnc)) {
+ if (e_gw_connection_get_junk_settings (js->cnc, &use_junk, &use_block, &use_pab, &persistence) == E_GW_CONNECTION_STATUS_OK) {
+ if (use_junk) {
+ js->enabled = TRUE;
+ gtk_toggle_button_set_active((GtkToggleButton *) js->enable, TRUE);
+ enable_clicked(js->enable , js);
+ gtk_widget_set_sensitive (GTK_WIDGET (js->table), TRUE);
+ } else {
+ gtk_toggle_button_set_active ((GtkToggleButton *) js->disable, TRUE);
+ disable_clicked (js->disable , js);
+ }
+ }
+ /* get list of containers */
+ if (e_gw_connection_get_junk_entries (js->cnc, &(list)) == E_GW_CONNECTION_STATUS_OK) {
+ js->users = g_list_length (list);
+ if (js->users) {
+/* I populate the list and set flags to 0 for the existing users*/
+ while (list) {
+ JunkEntry *junk_entry = g_new0 (JunkEntry , 1);
+ junk_entry->entry = list->data;
+ junk_entry->flag = 0;
+ entry = g_strdup ((junk_entry->entry)->match);
+ msg = g_strdup_printf ("%s", entry);
+ gtk_list_store_append (GTK_LIST_STORE (js->model), &(js->iter));
+ gtk_list_store_set (GTK_LIST_STORE (js->model), &(js->iter), 0, msg, -1);
+ js->junk_list = g_list_append (js->junk_list, junk_entry);
+
+ g_free (msg);
+ g_free (entry);
+ msg = NULL;
+ entry = NULL;
+ list = list->next;
+ }
+ }
+ }
+ else
+ g_warning("Could not get the JUNK List");
+ }
+}
+
+void
+commit_changes (JunkSettings *js)
+{
+ GList *new_list = NULL;
+ GList *remove_list = NULL;
+ GList *node = NULL;
+ JunkEntry *junk_entry = NULL;
+ EGwJunkEntry *entry;
+ int use_junk, use_pab, use_block, persistence;
+
+ for (node = js->junk_list; node; node = node->next)
+ {
+ junk_entry = node->data;
+ if (junk_entry->flag & 0x1)
+ new_list = g_list_append (new_list, junk_entry->entry);
+ else if (junk_entry->flag & 0x4) {
+ remove_list = g_list_append (remove_list, junk_entry->entry);
+ }
+ }
+
+ if (E_IS_GW_CONNECTION (js->cnc)) {
+ if(js->flag_for_ok == 2 && js->enabled){ /* just turn off the bits*/
+ use_junk = use_pab = use_block = persistence = 0;
+ if (e_gw_connection_modify_junk_settings (js->cnc, use_junk, use_pab, use_block, persistence) == E_GW_CONNECTION_STATUS_OK);
+
+ }
+ if (js->flag_for_ok == 0 && !js->enabled) {
+ use_block = use_pab =0;
+ use_junk = 1;
+ persistence = 14; /* We are setting the default persistence*/
+ if (e_gw_connection_modify_junk_settings (js->cnc, use_junk, use_pab, use_block, persistence) == E_GW_CONNECTION_STATUS_OK);
+ }
+
+ while (new_list) {
+ entry = new_list->data;
+ if (e_gw_connection_create_junk_entry (js->cnc, entry->match, "email", "junk") == E_GW_CONNECTION_STATUS_OK);
+ new_list = new_list->next;
+ }
+ while (remove_list) {
+ entry = remove_list->data;
+ if (e_gw_connection_remove_junk_entry (js->cnc, entry->id) == E_GW_CONNECTION_STATUS_OK);
+ remove_list = remove_list->next;
+ }
+
+ }
+ if(new_list){
+ g_list_foreach (new_list, (GFunc) free_entry_node, NULL);
+ g_list_free (new_list);
+ }
+ new_list = NULL;
+ if(remove_list){
+ g_list_foreach (remove_list,(GFunc) free_entry_node, NULL);
+ g_list_free (remove_list);
+ }
+ remove_list = NULL;
+}
+
+static void
+enable_clicked (GtkRadioButton *button, JunkSettings *js)
+{
+ js->flag_for_ok = 0;
+ gtk_widget_set_sensitive (GTK_WIDGET (js->table) ,TRUE);
+}
+
+static void
+disable_clicked (GtkRadioButton *button, JunkSettings *js)
+{
+ js->flag_for_ok = 2;
+ gtk_widget_set_sensitive (GTK_WIDGET (js->table), FALSE);
+}
+
+static void
+add_clicked(GtkButton *button, JunkSettings *js)
+{
+ const char *email = NULL;
+ const char *self_email = NULL;
+ JunkEntry *new_entry = NULL;
+ EGwJunkEntry *junk_entry = NULL;
+ gchar *msg = NULL;
+
+ self_email = g_strdup (e_gw_connection_get_user_email (js->cnc));
+ email = gtk_entry_get_text (js->entry);
+ /* You can't mark junk sender yourself*/
+ if (g_strrstr (email, "@") == NULL || (!g_ascii_strcasecmp (email , self_email)) || !g_ascii_strcasecmp (email, "" ))
+ return;
+ else {
+ /*check whether already exists*/
+ if (js->junk_list && email){
+ new_entry = find_node (js->junk_list, (gchar *)email);
+ if (new_entry)
+ return;
+
+ }
+ junk_entry = g_new0 (EGwJunkEntry, 1);
+ new_entry = g_new0 (JunkEntry, 1);
+ junk_entry->match = g_strdup(email);
+/*XXX:populate more fields*/
+ new_entry->entry = junk_entry;
+ new_entry->flag = 1;
+ msg = g_strdup (email);
+ gtk_list_store_append (GTK_LIST_STORE (js->model), &(js->iter));
+ gtk_list_store_set (GTK_LIST_STORE (js->model), &(js->iter), 0, msg, -1);
+ g_free(msg);
+ js->junk_list = g_list_append (js->junk_list, new_entry);
+ js->flag_for_ok = 0;
+ }
+ gtk_entry_set_text (GTK_ENTRY(js->entry), "");
+}
+
+static void
+remove_clicked(GtkButton *button, JunkSettings *js)
+{
+ JunkEntry *entry = NULL;
+ gchar *email;
+
+ gtk_tree_model_get ((GtkTreeModel *) js->model, &(js->iter), 0, &email, -1);
+ entry = find_node (js->junk_list, email);
+ if (entry->flag & 0x1) {
+ js->junk_list = g_list_remove (js->junk_list, entry);
+ free_node(entry);
+ } else {
+ entry->flag = 0;
+ entry->flag |= 0x4;
+ }
+ g_free (email);
+ gtk_list_store_remove (GTK_LIST_STORE (js->model), &(js->iter));
+}
+
+
+static void
+user_selected(GtkTreeSelection *selection, JunkSettings *js)
+{
+ gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);
+ if (gtk_tree_selection_get_selected (selection, &(js->model), &(js->iter))){
+ gtk_widget_set_sensitive (GTK_WIDGET (js->remove), TRUE);
+
+ }
+}
+
+static void
+junk_settings_construct (JunkSettings *js)
+{
+ GladeXML *xml;
+ GtkWidget *box;
+
+ xml = glade_xml_new (EVOLUTION_GLADEDIR "/junk-settings.glade", ROOTNODE, NULL);
+ js->xml =xml;
+
+ if (!js->xml) {
+ g_warning ("could not get xml");
+ }
+ js->vbox = GTK_VBOX (glade_xml_get_widget(js->xml, "vboxSettings"));
+ js->table = GTK_WIDGET (glade_xml_get_widget (js->xml, "vbox194"));
+ gtk_widget_set_sensitive (GTK_WIDGET (js->table), FALSE);
+
+ js->enable = GTK_RADIO_BUTTON (glade_xml_get_widget (js->xml, "radEnable"));
+ g_signal_connect ((gpointer) js->enable, "clicked", G_CALLBACK (enable_clicked), js);
+
+ js->disable = GTK_RADIO_BUTTON (glade_xml_get_widget (js->xml, "radDisable"));
+ g_signal_connect ((gpointer) js->disable, "clicked", G_CALLBACK (disable_clicked), js);
+
+ js->add_button = GTK_BUTTON (glade_xml_get_widget(js->xml, "Add"));
+ g_signal_connect((GtkWidget *) js->add_button, "clicked", G_CALLBACK (add_clicked), js);
+
+ js->remove = GTK_BUTTON(glade_xml_get_widget(js->xml, "Remove"));
+ g_signal_connect ((GtkWidget *) js->remove, "clicked", G_CALLBACK (remove_clicked), js);
+ gtk_widget_set_sensitive(GTK_WIDGET (js->remove), FALSE);
+
+ js->entry = GTK_ENTRY (glade_xml_get_widget (js->xml, "entry4"));
+ /*TODO:connect entry and label*/
+ box = GTK_WIDGET (glade_xml_get_widget (js->xml, "hbox227"));
+ gtk_widget_show ((GtkWidget *) js->entry);
+
+ js->scrolled_window = GTK_WIDGET (glade_xml_get_widget (js->xml,"scrolledwindow4"));
+
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (js->scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+
+ js->model = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN);
+ js->entry_list = gtk_tree_view_new ();
+ /*gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (js->scrolled_window), (GtkWidget *)js->entry_list);*/
+ gtk_container_add (GTK_CONTAINER (js->scrolled_window), (GtkWidget *)js->entry_list);
+ gtk_tree_view_set_model (GTK_TREE_VIEW (js->entry_list), GTK_TREE_MODEL (js->model));
+ gtk_widget_show (GTK_WIDGET (js->entry_list));
+
+ js->cell = gtk_cell_renderer_text_new ();
+ js->column = gtk_tree_view_column_new_with_attributes ("Email", js->cell, "text", 0, NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (js->entry_list),
+ GTK_TREE_VIEW_COLUMN (js->column));
+
+ g_signal_connect(gtk_tree_view_get_selection(GTK_TREE_VIEW (js->entry_list)), "changed", G_CALLBACK (user_selected), js);
+}
+
+JunkSettings *
+junk_settings_new (EGwConnection *ccnc)
+{
+ JunkSettings *new;
+ new = (JunkSettings *) g_object_new (junk_settings_get_type (), NULL);
+ junk_settings_construct (new);
+ new->cnc = ccnc;
+ if (new->cnc)
+ get_junk_list(new);
+
+ return (JunkSettings *) new;
+}
+
+
diff --git a/plugins/groupwise-features/junk-settings.glade b/plugins/groupwise-features/junk-settings.glade
new file mode 100644
index 0000000000..473b723d0b
--- /dev/null
+++ b/plugins/groupwise-features/junk-settings.glade
@@ -0,0 +1,494 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+<requires lib="gnome"/>
+
+<widget class="GtkWindow" id="main_page">
+ <property name="title" translatable="yes">Junk Mail Settings</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="decorated">True</property>
+ <property name="skip_taskbar_hint">False</property>
+ <property name="skip_pager_hint">False</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
+ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+ <property name="focus_on_map">True</property>
+
+ <child>
+ <widget class="GtkNotebook" id="sharing_props">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="show_tabs">True</property>
+ <property name="show_border">True</property>
+ <property name="tab_pos">GTK_POS_TOP</property>
+ <property name="scrollable">False</property>
+ <property name="enable_popup">False</property>
+
+ <child>
+ <widget class="GtkVBox" id="vboxSettings">
+ <property name="border_width">12</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkVBox" id="vboxSharingOptions">
+ <property name="width_request">0</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox186">
+ <property name="width_request">0</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="label539">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox190">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkRadioButton" id="radDisable">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Disable</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioButton" id="radEnable">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Enable</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radDisable</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox194">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox226">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox195">
+ <property name="width_request">234</property>
+ <property name="height_request">209</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox227">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label557">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Email:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="entry4">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="padding">2</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="users">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Junk List :&lt;/b&gt;</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">6</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow4">
+ <property name="width_request">282</property>
+ <property name="height_request">150</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
+ <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
+ <property name="shadow_type">GTK_SHADOW_NONE</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">6</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox196">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkButton" id="Add">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment4">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox229">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+
+ <child>
+ <widget class="GtkImage" id="image3">
+ <property name="visible">True</property>
+ <property name="stock">gtk-add</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label561">
+ <property name="width_request">29</property>
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Add</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="Remove">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment5">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox230">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
+
+ <child>
+ <widget class="GtkImage" id="image4">
+ <property name="visible">True</property>
+ <property name="stock">gtk-remove</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label562">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Remove</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="tab_expand">False</property>
+ <property name="tab_fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="lblJunkList">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Junk List</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_CENTER</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+</glade-interface>
diff --git a/plugins/groupwise-features/junk-settings.h b/plugins/groupwise-features/junk-settings.h
new file mode 100644
index 0000000000..b5bb22c72c
--- /dev/null
+++ b/plugins/groupwise-features/junk-settings.h
@@ -0,0 +1,103 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Authors: Vivek Jain <jvivek@novell.com>
+ *
+ * Copyright 2005 Novell, Inc. (www.novell.com)
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef __JUNK_SETTINGS_H__
+#define __JUNK_SETTINGS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus */
+
+#include <glib.h>
+#include <gtk/gtkvbox.h>
+#include <gtk/gtk.h>
+#include <camel/camel-store.h>
+#include <e-gw-connection.h>
+
+#define _JUNK_SETTINGS_TYPE (junk_settings_get_type ())
+#define JUNK_SETTINGS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), JUNK_SETTINGS, JunkSettings))
+#define JUNK_SETTINGS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), JUNK_SETTINGS_TYPE, JunkSettings))
+#define IS_JUNK_SETTINGS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), JUNK_SETTINGS_TYPE))
+#define IS_JUNK_SETTINGS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), JUNK_SETTINGS_TYPE))
+
+typedef struct _JunkSettings JunkSettings;
+typedef struct _JunkSettingsClass JunkSettingsClass;
+
+struct _GtkWidget;
+struct _GladeXML;
+struct _GtkButton;
+struct _GtkTreeView;
+struct _GtkLabel;
+struct _GtkEntry;
+struct _GtkWindow;
+struct _GtkRadioButton;
+struct _GtkListStore;
+struct _GtkCellRenderer;
+struct _GtkTreeViewColumn;
+struct _GtkFrame;
+struct _GtkVBox;
+
+struct _JunkSettings {
+ GtkVBox parent_object;
+
+ struct _GladeXML *xml;
+
+ /* General tab */
+
+ /* Default Behavior */
+ struct _GtkTreeView *entry_list;
+ struct _GtkButton *add_button;
+ struct _GtkButton *remove;
+ struct _GtkEntry *entry;
+ struct _GtkRadioButton *enable;
+ struct _GtkRadioButton *disable;
+ struct _GtkWidget *scrolled_window;
+ struct _GtkListStore *model;
+ struct _GtkCellRenderer *cell;
+ struct _GtkTreeViewColumn *column;
+ struct _GtkVBox *vbox;
+ struct _GtkVBox *table;
+ struct _GtkWidget *window;
+
+ GList *junk_list;
+ gint users;
+ gint flag_for_ok;
+ gboolean enabled;
+ EGwConnection *cnc;
+ GtkTreeIter iter;
+};
+
+struct _JunkSettingsClass {
+ GtkVBoxClass parent_class;
+
+};
+
+GType junk_settings_get_type (void);
+struct _JunkSettings * junk_settings_new (EGwConnection *ccnc);
+void commit_changes (JunkSettings *js);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __JUNK_SETTINGS_H__ */