aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorJohnny Jacob <jjohnny@src.gnome.org>2008-05-23 14:19:26 +0800
committerJohnny Jacob <jjohnny@src.gnome.org>2008-05-23 14:19:26 +0800
commit28e5262d541d66b204f1017b5cdb12571593fb2a (patch)
tree35fc8cb62f519fb8f81eb6b1568fc523ce9d4ed2 /plugins
parentde67fcdb7cf04201174bb62c32eda7ad9e1e323f (diff)
downloadgsoc2013-evolution-28e5262d541d66b204f1017b5cdb12571593fb2a.tar
gsoc2013-evolution-28e5262d541d66b204f1017b5cdb12571593fb2a.tar.gz
gsoc2013-evolution-28e5262d541d66b204f1017b5cdb12571593fb2a.tar.bz2
gsoc2013-evolution-28e5262d541d66b204f1017b5cdb12571593fb2a.tar.lz
gsoc2013-evolution-28e5262d541d66b204f1017b5cdb12571593fb2a.tar.xz
gsoc2013-evolution-28e5262d541d66b204f1017b5cdb12571593fb2a.tar.zst
gsoc2013-evolution-28e5262d541d66b204f1017b5cdb12571593fb2a.zip
Attachment Reminder - Fixes Bug #529995. Disable the plugin when user says - do not show this message again
svn path=/trunk/; revision=35529
Diffstat (limited to 'plugins')
-rw-r--r--plugins/attachment-reminder/ChangeLog14
-rw-r--r--plugins/attachment-reminder/apps-evolution-attachment-reminder.schemas.in15
-rw-r--r--plugins/attachment-reminder/attachment-reminder.c60
-rw-r--r--plugins/attachment-reminder/attachment-reminder.glade284
4 files changed, 141 insertions, 232 deletions
diff --git a/plugins/attachment-reminder/ChangeLog b/plugins/attachment-reminder/ChangeLog
index 2bcf880ff1..c06349e093 100644
--- a/plugins/attachment-reminder/ChangeLog
+++ b/plugins/attachment-reminder/ChangeLog
@@ -1,5 +1,19 @@
2008-05-22 Johnny Jacob <jjohnny@novell.com>
+
+ ** Fixes Bug #529995
+
+ * attachment-reminder.c (ask_for_missing_attachment): Disable the plugin.
+
+ * apps-evolution-attachment-reminder.schemas.in: Removed GConf key.
+ * attachment-reminder.c (toggle_cb): Removed.
+ (e_plugin_lib_get_configure_widget): Remove "Remind missing attachments"
+ check button.
+ (org_gnome_evolution_attachment_reminder): Removed Gconf key
+ for enable/disable .
+
+2008-05-22 Johnny Jacob <jjohnny@novell.com>
+
* attachment-reminder.c (strip_text_msg): Wrong condition check
2008-05-20 Johnny Jacob <jjohnny@novell.com>
diff --git a/plugins/attachment-reminder/apps-evolution-attachment-reminder.schemas.in b/plugins/attachment-reminder/apps-evolution-attachment-reminder.schemas.in
index bec59ae40a..c75bc34247 100644
--- a/plugins/attachment-reminder/apps-evolution-attachment-reminder.schemas.in
+++ b/plugins/attachment-reminder/apps-evolution-attachment-reminder.schemas.in
@@ -1,21 +1,6 @@
<gconfschemafile>
<schemalist>
<schema>
- <key>/schemas/apps/evolution/mail/prompts/attachment_presend_check</key>
- <applyto>/apps/evolution/mail/prompts/attachment_presend_check</applyto>
- <owner>evolution-mail</owner>
- <type>bool</type>
- <default>true</default>
- <locale name="C">
- <short>Enable attachment reminder plugin</short>
- <long>Enable attachment reminder plugin.</long>
- </locale>
- </schema>
-
-
- <!-- Labels and Colours -->
-
- <schema>
<key>/schemas/apps/evolution/mail/attachment_reminder_clues</key>
<applyto>/apps/evolution/mail/attachment_reminder_clues</applyto>
<owner>evolution-mail</owner>
diff --git a/plugins/attachment-reminder/attachment-reminder.c b/plugins/attachment-reminder/attachment-reminder.c
index 10c69bd59a..506bd53669 100644
--- a/plugins/attachment-reminder/attachment-reminder.c
+++ b/plugins/attachment-reminder/attachment-reminder.c
@@ -45,8 +45,6 @@
#include "widgets/misc/e-attachment-bar.h"
#include "composer/e-msg-composer.h"
-
-#define GCONF_KEY_ATTACHMENT_REMINDER "/apps/evolution/mail/prompts/attachment_presend_check"
#define GCONF_KEY_ATTACH_REMINDER_CLUES "/apps/evolution/mail/attachment_reminder_clues"
#define SIGNATURE "-- "
@@ -73,11 +71,10 @@ GtkWidget *e_plugin_lib_get_configure_widget (EPlugin *epl);
void org_gnome_evolution_attachment_reminder (EPlugin *ep, EMEventTargetComposer *t);
GtkWidget* org_gnome_attachment_reminder_config_option (struct _EPlugin *epl, struct _EConfigHookItemFactoryData *data);
-static gboolean ask_for_missing_attachment (GtkWindow *widget);
+static gboolean ask_for_missing_attachment (EPlugin *ep, GtkWindow *widget);
static gboolean check_for_attachment_clues (gchar *msg);
static gboolean check_for_attachment (EMsgComposer *composer);
static gchar* strip_text_msg (gchar *msg);
-static void toggle_cb (GtkWidget *widget, UIData *ui);
static void commit_changes (UIData *ui);
static void cell_edited_callback (GtkCellRendererText *cell, gchar *path_string,
@@ -94,18 +91,10 @@ e_plugin_lib_enable (EPluginLib *ep, int enable)
void
org_gnome_evolution_attachment_reminder (EPlugin *ep, EMEventTargetComposer *t)
{
- GConfClient *gconf;
GByteArray *raw_msg_barray;
gchar *filtered_str = NULL;
- gconf = gconf_client_get_default ();
- if (!gconf_client_get_bool (gconf, GCONF_KEY_ATTACHMENT_REMINDER, NULL)){
- g_object_unref (gconf);
- return;
- } else
- g_object_unref (gconf);
-
raw_msg_barray = e_msg_composer_get_raw_message_text (t->composer);
if (!raw_msg_barray)
@@ -114,20 +103,38 @@ org_gnome_evolution_attachment_reminder (EPlugin *ep, EMEventTargetComposer *t)
raw_msg_barray = g_byte_array_append (raw_msg_barray, (const guint8 *)"", 1);
filtered_str = strip_text_msg ((gchar *) raw_msg_barray->data);
+
g_byte_array_free (raw_msg_barray, TRUE);
/* Set presend_check_status for the composer*/
if (check_for_attachment_clues (filtered_str) && !check_for_attachment (t->composer))
- if (!ask_for_missing_attachment ((GtkWindow *)t->composer))
+ if (!ask_for_missing_attachment (ep, (GtkWindow *)t->composer))
g_object_set_data ((GObject *) t->composer, "presend_check_status", GINT_TO_POINTER(1));
g_free (filtered_str);
}
static gboolean
-ask_for_missing_attachment (GtkWindow *window)
+ask_for_missing_attachment (EPlugin *ep, GtkWindow *window)
{
- return em_utils_prompt_user(window, GCONF_KEY_ATTACHMENT_REMINDER ,"org.gnome.evolution.plugins.attachment_reminder:attachment-reminder", NULL);
+ GtkWidget *mbox, *check = NULL;
+ gint response;
+
+ mbox = e_error_new(window, "org.gnome.evolution.plugins.attachment_reminder:attachment-reminder", NULL);
+
+ check = gtk_check_button_new_with_mnemonic (_("_Do not show this message again."));
+ gtk_container_set_border_width((GtkContainer *)check, 12);
+ gtk_box_pack_start ((GtkBox *)((GtkDialog *) mbox)->vbox, check, TRUE, TRUE, 0);
+ gtk_widget_show (check);
+
+ response = gtk_dialog_run ((GtkDialog *) mbox);
+
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check)))
+ e_plugin_enable (ep, FALSE);
+
+ gtk_widget_destroy(mbox);
+
+ return response == GTK_RESPONSE_YES;
}
/* check for the clues */
@@ -135,7 +142,6 @@ static gboolean
check_for_attachment_clues (gchar *msg)
{
/* TODO : Add more strings. RegEx ??? */
-
GConfClient *gconf;
GSList *clue_list = NULL, *list;
gboolean ret_val = FALSE;
@@ -150,7 +156,6 @@ check_for_attachment_clues (gchar *msg)
g_object_unref (gconf);
msg_length = strlen (msg);
-
for (list = clue_list;list && !ret_val;list=g_slist_next(list)) {
gchar *needle = g_utf8_strdown (list->data, -1);
if (g_strstr_len (msg, msg_length, needle)) {
@@ -404,17 +409,6 @@ clue_edit_clicked (GtkButton *button, UIData *ui)
}
static void
-toggle_cb (GtkWidget *widget, UIData *ui)
-{
-
- gboolean active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
- ui->gconf = gconf_client_get_default();
-
- gconf_client_set_bool (ui->gconf, GCONF_KEY_ATTACHMENT_REMINDER, active, NULL);
- gtk_widget_set_sensitive (ui->clue_container, active);
-}
-
-static void
selection_changed (GtkTreeSelection *selection, UIData *ui)
{
GtkTreeModel *model;
@@ -449,10 +443,9 @@ e_plugin_lib_get_configure_widget (EPlugin *epl)
GtkTreeSelection *selection;
GtkTreeIter iter;
GConfClient *gconf = gconf_client_get_default();
- GtkWidget *button, *hbox;
+ GtkWidget *hbox;
GSList *clue_list = NULL, *list;
GtkTreeModel *model;
- gboolean enable_ui;
UIData *ui = g_new0 (UIData, 1);
@@ -465,7 +458,6 @@ e_plugin_lib_get_configure_widget (EPlugin *epl)
g_free (gladefile);
ui->gconf = gconf_client_get_default ();
- enable_ui = gconf_client_get_bool (ui->gconf, GCONF_KEY_ATTACHMENT_REMINDER, NULL);
ui->treeview = glade_xml_get_widget (ui->xml, "clue_treeview");
@@ -511,14 +503,8 @@ e_plugin_lib_get_configure_widget (EPlugin *epl)
g_slist_free (clue_list);
}
- /* Enable / Disable */
- button = glade_xml_get_widget (ui->xml, "reminder_enable_check");
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button) , enable_ui);
- g_signal_connect (G_OBJECT (button), "toggled", G_CALLBACK (toggle_cb), ui);
-
/* Add the list here */
ui->clue_container = glade_xml_get_widget (ui->xml, "clue_container");
- gtk_widget_set_sensitive (ui->clue_container, enable_ui);
hbox = gtk_vbox_new (FALSE, 0);
diff --git a/plugins/attachment-reminder/attachment-reminder.glade b/plugins/attachment-reminder/attachment-reminder.glade
index 1e54944e34..dbf953d2a5 100644
--- a/plugins/attachment-reminder/attachment-reminder.glade
+++ b/plugins/attachment-reminder/attachment-reminder.glade
@@ -1,182 +1,106 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
-
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
+<!--*- mode: xml -*-->
<glade-interface>
-
-<widget class="GtkWindow" id="window1">
- <property name="visible">True</property>
- <property name="title" translatable="no">window1</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>
- <property name="urgency_hint">False</property>
-
- <child>
- <widget class="GtkVBox" id="reminder_configuration_box">
- <property name="width_request">385</property>
- <property name="height_request">189</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">5</property>
-
- <child>
- <widget class="GtkCheckButton" id="reminder_enable_check">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Remind _missing attachments</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="GtkTable" id="clue_container">
- <property name="visible">True</property>
- <property name="n_rows">1</property>
- <property name="n_columns">3</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">7</property>
-
- <child>
- <widget class="GtkScrolledWindow" id="scrolledwindow1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="shadow_type">GTK_SHADOW_NONE</property>
- <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
-
- <child>
- <widget class="GtkTreeView" id="clue_treeview">
- <property name="border_width">1</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="headers_visible">True</property>
- <property name="rules_hint">False</property>
- <property name="reorderable">False</property>
- <property name="enable_search">True</property>
- <property name="fixed_height_mode">False</property>
- <property name="hover_selection">False</property>
- <property name="hover_expand">False</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVButtonBox" id="vbuttonbox2">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_START</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkButton" id="clue_add">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-add</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="clue_edit">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-edit</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="clue_remove">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-remove</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options"></property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label1">
- <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</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="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_padding">12</property>
- <property name="x_options"></property>
- <property name="y_options"></property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
+ <widget class="GtkWindow" id="window1">
+ <property name="visible">True</property>
+ <property name="title">window1</property>
+ <child>
+ <widget class="GtkVBox" id="reminder_configuration_box">
+ <property name="width_request">385</property>
+ <property name="height_request">189</property>
+ <property name="visible">True</property>
+ <property name="spacing">5</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <widget class="GtkTable" id="clue_container">
+ <property name="visible">True</property>
+ <property name="n_rows">1</property>
+ <property name="n_columns">3</property>
+ <property name="column_spacing">7</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <widget class="GtkVButtonBox" id="vbuttonbox2">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <property name="layout_style">GTK_BUTTONBOX_START</property>
+ <child>
+ <widget class="GtkButton" id="clue_add">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="label">gtk-add</property>
+ <property name="use_stock">True</property>
+ <property name="response_id">0</property>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkButton" id="clue_edit">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="label">gtk-edit</property>
+ <property name="use_stock">True</property>
+ <property name="response_id">0</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="clue_remove">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="label">gtk-remove</property>
+ <property name="use_stock">True</property>
+ <property name="response_id">0</property>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <child>
+ <widget class="GtkTreeView" id="clue_treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="border_width">1</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
</glade-interface>