[evolution-rss] disable edit dialog while processing



commit d9d6a16ec4081d5f278e1c58d0b504b97b9ccc9e
Author: Lucian Langa <lucilanga gnome org>
Date:   Wed Oct 21 22:27:00 2009 +0300

    disable edit dialog while processing

 src/misc.c                            |   24 ++++----
 src/network-soup.c                    |   30 +++++-----
 src/org-gnome-evolution-rss.eplug.xml |   20 +++---
 src/rss-config-factory.c              |  105 +++++++++++++++++----------------
 src/rss.c                             |    2 +-
 5 files changed, 93 insertions(+), 88 deletions(-)
---
diff --git a/src/misc.c b/src/misc.c
index e236197..bde905f 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -1,16 +1,16 @@
 /*  Evoution RSS Reader Plugin
- *  Copyright (C) 2007-2009  Lucian Langa <cooly gnome eu org> 
- *  
+ *  Copyright (C) 2007-2009  Lucian Langa <cooly gnome eu org>
+ *
  *  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 
+ *  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 Place, Suite 330, Boston, MA  02111-1307  USA
@@ -37,29 +37,29 @@ int getNumericConfValue(gpointer a);
 int
 getNumericConfValue(gpointer a)
 {
- 	return 1;
+	return 1;
 }
- 
+
 int on_next_unread_item_activate(gpointer a);
 
 int
 on_next_unread_item_activate(gpointer a)
 {
- 	return 1;
+	return 1;
 }
- 
+
 void
 print_hash(gpointer key, gpointer value, gpointer user_data)
 {
- 	g_print("key:%s, value:%s\n", (gchar *)key, (gchar *)value);
+	g_print("key:%s, value:%s\n", (gchar *)key, (gchar *)value);
 }
 
 void
 print_hash_int(gpointer key, gpointer value, gpointer user_data)
 {
- 	g_print("key:%s, value:%d\n", (gchar *)key, GPOINTER_TO_INT(value));
+	g_print("key:%s, value:%d\n", (gchar *)key, GPOINTER_TO_INT(value));
 }
- 
+
 void free_hash(gpointer key, gpointer value, gpointer user_data);
 
 void
diff --git a/src/network-soup.c b/src/network-soup.c
index 7e20599..85886d0 100644
--- a/src/network-soup.c
+++ b/src/network-soup.c
@@ -1,16 +1,16 @@
 /*  Evolution RSS Reader Plugin
  *  Copyright (C) 2007-2009 Lucian Langa <cooly gnome eu org>
- *         
+ *
  *  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 
+ *  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 Place, Suite 330, Boston, MA  02111-1307  USA
@@ -104,14 +104,14 @@ got_chunk_cb(SoupMessage *msg, SoupBuffer *chunk, CallbackInfo *info) {
 
 	NetStatusProgress *progress = NULL;
 	const char* clen;
-	
+
 	if (info->total == 0) {
 #if LIBSOUP_VERSION < 2003000
 		clen = soup_message_get_header(msg->response_headers,
 				"Content-length");
 			return;
 #else
-        	clen = soup_message_headers_get(msg->response_headers,
+		clen = soup_message_headers_get(msg->response_headers,
 				"Content-length");
 #endif
 		if (!clen)
@@ -289,7 +289,7 @@ read_up(gpointer data)
 	char rfeed[512];
 	guint res = 0;
 	gchar *tmp, *buf, *feed_dir, *feed_name;
-	
+
 	if (NULL != g_hash_table_lookup(rf->hruser, data))
 		return 1;
 
@@ -305,11 +305,11 @@ read_up(gpointer data)
 
 	fr = fopen(feed_name, "r");
 	if (fr) {
-        	fgets(rfeed, 511, fr);
-        	g_hash_table_insert(rf->hruser, data, g_strstrip(g_strdup(rfeed)));
-        	fgets(rfeed, 511, fr);
-        	g_hash_table_insert(rf->hrpass, data, g_strstrip(g_strdup(rfeed)));
-        	fclose(fr);
+		fgets(rfeed, 511, fr);
+		g_hash_table_insert(rf->hruser, data, g_strstrip(g_strdup(rfeed)));
+		fgets(rfeed, 511, fr);
+		g_hash_table_insert(rf->hrpass, data, g_strstrip(g_strdup(rfeed)));
+		fclose(fr);
 		res = 1;
 	}
 	g_free(feed_name);
@@ -339,9 +339,9 @@ save_up(gpointer data)
 			fputs(user, fr);
 	        fputs("\n", fr);
 		pass = g_hash_table_lookup(rf->hrpass, data);
-        	fputs(pass, fr);
-        	fclose(fr);
-        	res = 1;
+		fputs(pass, fr);
+		fclose(fr);
+		res = 1;
 	}
 	g_free(feed_name);
 	g_free(buf);
diff --git a/src/org-gnome-evolution-rss.eplug.xml b/src/org-gnome-evolution-rss.eplug.xml
index c722705..9331cb0 100644
--- a/src/org-gnome-evolution-rss.eplug.xml
+++ b/src/org-gnome-evolution-rss.eplug.xml
@@ -12,7 +12,7 @@
 
 This plugin adds RSS Feeds support for evolution mail. RSS support was built upon the somewhat existing RSS support in evolution-1.4 branch. The motivation behind this was to have RSS in same place as mails, at this moment I do not see the point having a separate RSS reader since a RSS Article is like an email message.
 
-Evolution RSS can display article using summary view or HTML view. 
+Evolution RSS can display article using summary view or HTML view.
 
 HTML can be displayed using the following engines: gtkHTML, Apple's Webkit or Firefox/Gecko.
 
@@ -36,14 +36,14 @@ HTML can be displayed using the following engines: gtkHTML, Apple's Webkit or Fi
 	+RSS_MENU+
 
 	<hook class="org.gnome.evolution.mail.events:1.0">
-        	<event type="pass" target="message" id="message.reading" handle="org_gnome_cooly_article_show"/>
+		<event type="pass" target="message" id="message.reading" handle="org_gnome_cooly_article_show"/>
 	</hook>
 	<hook class="org.gnome.evolution.mail.events:1.0">
-        	<event type="pass" target="folder" id="folder.customicon" handle="org_gnome_cooly_folder_icon"/>
+		<event type="pass" target="folder" id="folder.customicon" handle="org_gnome_cooly_folder_icon"/>
 	</hook>
 
 	<hook class="org.gnome.evolution.mail.events:1.0">
-        	<event type="pass" target="folder" id="folder.refresh" handle="org_gnome_cooly_folder_refresh"/>
+		<event type="pass" target="folder" id="folder.refresh" handle="org_gnome_cooly_folder_refresh"/>
 	</hook>
 
 	<hook class="org.gnome.evolution.mail.events:1.0">
@@ -69,14 +69,14 @@ HTML can be displayed using the following engines: gtkHTML, Apple's Webkit or Fi
       </group>
     </hook>
 	<hook class="org.gnome.evolution.mail.config:1.0">
-                <group id="org.gnome.evolution.mail.folderConfig" 
+                <group id="org.gnome.evolution.mail.folderConfig"
                         target="folder"
                         abort="rss_folder_factory_abort"
                         commit="rss_folder_factory_commit">
-                <item 
-                        type="page" 
-                        path="10.size" 
-                        _label="Size" 
+                <item
+                        type="page"
+                        path="10.size"
+                        _label="Size"
                         factory="rss_folder_factory"/>
                 </group>
         </hook>
@@ -88,7 +88,7 @@ HTML can be displayed using the following engines: gtkHTML, Apple's Webkit or Fi
 
 
 <hook class="org.gnome.evolution.mail.events:1.0">
-    <event id="mail.sendreceive" 
+    <event id="mail.sendreceive"
 	enable="sendreceive"
 	handle="org_gnome_cooly_rss"
 	target="sendreceive"/>
diff --git a/src/rss-config-factory.c b/src/rss-config-factory.c
index d876d8b..15094bd 100644
--- a/src/rss-config-factory.c
+++ b/src/rss-config-factory.c
@@ -447,9 +447,9 @@ build_dialog_add(gchar *url, gchar *feed_text)
         feed_name = (GtkWidget *)glade_xml_get_widget (gui, "feed_name");
 	if (url != NULL) {
 		flabel = g_build_path("/",
-				lookup_main_folder(),
-				lookup_feed_folder(feed_text),
-				NULL);
+			lookup_main_folder(),
+			lookup_feed_folder(feed_text),
+			NULL);
 		gtk_label_set_text(GTK_LABEL(entry2), flabel);
 		fname = g_path_get_basename(lookup_feed_folder(feed_text));
 		gtk_entry_set_text(GTK_ENTRY(feed_name), fname);
@@ -612,6 +612,8 @@ actions_dialog_add(add_feed *feed, gchar *url)
 	gint result = gtk_dialog_run(GTK_DIALOG(feed->dialog));
 	switch (result) {
 	case GTK_RESPONSE_OK:
+		//grey out while were processing
+		gtk_widget_set_sensitive(feed->dialog, FALSE);
 		feed->feed_url = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry1)));
 		fhtml = gtk_toggle_button_get_active (
 		        GTK_TOGGLE_BUTTON (checkbutton1));
@@ -1092,11 +1094,11 @@ process_dialog_edit(add_feed *feed, gchar *url, gchar *feed_name)
 			//prevent adding of an existing feed (url)
 			//which might screw things
                         if (g_hash_table_find(rf->hr,
-                                                check_if_match,
-						feed->feed_url)) {
+				check_if_match,
+				feed->feed_url)) {
 				rss_error(NULL, NULL, _("Error adding feed."),
-                                                        _("Feed already exists!"));
-                                                goto out;
+					_("Feed already exists!"));
+				goto out;
 			}
 			saved_feed = save_feed_hash(feed_name);
 			remove_feed_hash(feed_name);
@@ -2347,6 +2349,8 @@ void rss_folder_factory_commit (EPlugin *epl, EConfigTarget *target)
 	|| !g_ascii_strcasecmp(folder, main_folder))
 		return;
 
+	gtk_widget_set_sensitive(target->config->widget, FALSE);
+
 	entry1 = (GtkWidget *)glade_xml_get_widget (feed->gui, "url_entry");
 	checkbutton1 = (GtkWidget *)glade_xml_get_widget (feed->gui, "html_check");
 	checkbutton2 = (GtkWidget *)glade_xml_get_widget (feed->gui, "enabled_check");
@@ -2373,54 +2377,55 @@ void rss_folder_factory_commit (EPlugin *epl, EConfigTarget *target)
 	fhtml ^= 1;
         feed->fetch_html = fhtml;
 	feed->enabled = gtk_toggle_button_get_active(
-                        GTK_TOGGLE_BUTTON(checkbutton2));
+		GTK_TOGGLE_BUTTON(checkbutton2));
 	feed->validate = gtk_toggle_button_get_active(
-			GTK_TOGGLE_BUTTON(checkbutton3));
+		GTK_TOGGLE_BUTTON(checkbutton3));
 	while (i<4) {
-                        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radiobutton1)))
-                                break;
-                        i++;
-                        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radiobutton2)))
-                                break;
-                        i++;
-                        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radiobutton3)))
-                                break;
-                        i++;
-                        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radiobutton7)))
-                                break;
+		if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radiobutton1)))
+			break;
+		i++;
+		if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radiobutton2)))
+			break;
+		i++;
+		if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radiobutton3)))
+			break;
+		i++;
+		if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radiobutton7)))
+			break;
 	}
         feed->del_feed=i;
-                feed->del_unread = gtk_toggle_button_get_active(
-                        GTK_TOGGLE_BUTTON(checkbutton4));
-                gtk_spin_button_update((GtkSpinButton *)spinbutton1);
-                feed->del_messages = gtk_spin_button_get_value((GtkSpinButton *)spinbutton1);
-                gtk_spin_button_update((GtkSpinButton *)spinbutton2);
-                feed->del_days = gtk_spin_button_get_value((GtkSpinButton *)spinbutton2);
-                i=1;
-                while (i<3) {
-                        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radiobutton4)))
-                                break;
-                        i++;
-                        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radiobutton5)))
-                                break;
+	feed->del_unread = gtk_toggle_button_get_active(
+				GTK_TOGGLE_BUTTON(checkbutton4));
+	gtk_spin_button_update((GtkSpinButton *)spinbutton1);
+	feed->del_messages = gtk_spin_button_get_value((GtkSpinButton *)spinbutton1);
+	gtk_spin_button_update((GtkSpinButton *)spinbutton2);
+	feed->del_days = gtk_spin_button_get_value((GtkSpinButton *)spinbutton2);
+	i=1;
+	while (i<3) {
+		if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radiobutton4)))
+			break;
+		i++;
+		if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radiobutton5)))
+			break;
                         i++;
-                        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radiobutton6)))
-                                break;
-                }
-                feed->update=i;
-                feed->ttl = gtk_spin_button_get_value((GtkSpinButton *)ttl_value);
-                feed->add = 1;
-		feed->feed_name = feed_name;
-                // there's no reason to feetch feed if url isn't changed
-		if (url && !strncmp(url, feed->feed_url, strlen(url)))
-			feed->changed = 0;
-		else
-			feed->changed = 1;
-		if (feed_name && !g_ascii_strncasecmp(feed_name, ofolder, strlen(feed_name)))
-			feed->renamed = 0;
-		else
-			feed->renamed = 1;
-		process_dialog_edit(feed, url, ofolder);
+		if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radiobutton6)))
+			break;
+	}
+	feed->update=i;
+	feed->ttl = gtk_spin_button_get_value((GtkSpinButton *)ttl_value);
+	feed->add = 1;
+	feed->feed_name = feed_name;
+	// there's no reason to feetch feed if url isn't changed
+	if (url && !strncmp(url, feed->feed_url, strlen(url)))
+		feed->changed = 0;
+	else
+		feed->changed = 1;
+	if (feed_name && !g_ascii_strncasecmp(feed_name, ofolder, strlen(feed_name)))
+		feed->renamed = 0;
+	else
+		feed->renamed = 1;
+
+	process_dialog_edit(feed, url, ofolder);
 
 	authuser = (GtkWidget *)glade_xml_get_widget (feed->gui, "auth_user");
 	authpass = (GtkWidget *)glade_xml_get_widget (feed->gui, "auth_pass");
diff --git a/src/rss.c b/src/rss.c
index 3c137fb..b053c01 100644
--- a/src/rss.c
+++ b/src/rss.c
@@ -761,7 +761,7 @@ user_pass_cb(RSS_AUTH *auth_info, gint response, GtkDialog *dialog)
 		auth_info->user = g_hash_table_lookup(rf->hruser, auth_info->url);
 		auth_info->pass = g_hash_table_lookup(rf->hrpass, auth_info->url);
 		if (!auth_info->retrying)
-			soup_auth_authenticate (auth_info->soup_auth, 
+			soup_auth_authenticate (auth_info->soup_auth,
 					auth_info->user,
 					auth_info->pass);
                 break;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]