im.pidgin.pidgin: 9d8120be512c235d76a8f6fee60cae024da8772e

nosnilmot at pidgin.im nosnilmot at pidgin.im
Sat Nov 3 16:25:51 EDT 2007


-----------------------------------------------------------------
Revision: 9d8120be512c235d76a8f6fee60cae024da8772e
Ancestor: 625f14c0e2e18d73bf56f236a3d5d34ee651501c
Author: nosnilmot at pidgin.im
Date: 2007-11-03T20:20:06
Branch: im.pidgin.pidgin

Modified files:
        pidgin/gtkprefs.c

ChangeLog: 

Add a button in preferences to launch Gnome preferred application
configuration program to set browser if running Gnome.

-------------- next part --------------
============================================================
--- pidgin/gtkprefs.c	d484b2baaf83d4415c765c286227abaf9fda4a0b
+++ pidgin/gtkprefs.c	769a72f5a5bae2e2188617e1c88c6f466a141a9a
@@ -1126,13 +1126,26 @@ proxy_button_clicked_cb(GtkWidget *butto
 	g_error_free(err);
 }
 
+static void
+browser_button_clicked_cb(GtkWidget *button, gpointer null)
+{
+	GError *err = NULL;
+
+	if (g_spawn_command_line_async ("gnome-default-applications-properties", &err))
+		return;
+
+	purple_notify_error(NULL, NULL, _("Cannot start browser configuration program."), err->message);
+	g_error_free(err);
+}
+
 static GtkWidget *
 network_page()
 {
 	GtkWidget *ret;
 	GtkWidget *vbox, *hbox, *entry;
 	GtkWidget *table, *label, *auto_ip_checkbox, *ports_checkbox, *spin_button;
-	GtkWidget *warning = NULL, *proxy_button = NULL;
+	GtkWidget *proxy_warning = NULL, *browser_warning = NULL;
+	GtkWidget *proxy_button = NULL, *browser_button = NULL;
 	GtkSizeGroup *sg;
 	PurpleProxyInfo *proxy_info = NULL;
 
@@ -1217,11 +1230,11 @@ network_page()
 	g_signal_connect(G_OBJECT(ports_checkbox), "clicked",
 					 G_CALLBACK(pidgin_toggle_sensitive), spin_button);
 
-	vbox = pidgin_make_frame(ret, _("Proxy Server"));
-	prefs_proxy_frame = gtk_vbox_new(FALSE, 0);
+	if (purple_running_gnome()) {
+		vbox = pidgin_make_frame(ret, _("Proxy Server & Browser"));
+		prefs_proxy_frame = gtk_vbox_new(FALSE, 0);
 
-	if (purple_running_gnome()) {
-		warning = hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
+		proxy_warning = hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
 		gtk_container_add(GTK_CONTAINER(vbox), hbox);
 
 		label = gtk_label_new(NULL);
@@ -1229,10 +1242,18 @@ network_page()
 		                     _("<b>Proxy configuration program was not found.</b>"));
 		gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
 
+		browser_warning = hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
+		gtk_container_add(GTK_CONTAINER(vbox), hbox);
+
+		label = gtk_label_new(NULL);
+		gtk_label_set_markup(GTK_LABEL(label),
+		                     _("<b>Browser configuration program was not found.</b>"));
+		gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
 		hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
 		gtk_container_add(GTK_CONTAINER(vbox), hbox);
-		label = gtk_label_new(_("Proxy preferences are configured in\n"
-		                        "GNOME Control Center: Desktop Preferences"));
+		label = gtk_label_new(_("Proxy & Browser preferences are configured\n"
+		                        "in GNOME Preferences"));
 		gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
 		gtk_widget_show(label);
 
@@ -1243,7 +1264,15 @@ network_page()
 		                 G_CALLBACK(proxy_button_clicked_cb), NULL);
 		gtk_box_pack_start(GTK_BOX(hbox), proxy_button, FALSE, FALSE, 0);
 		gtk_widget_show(proxy_button);
+		browser_button = gtk_button_new_with_mnemonic(_("Configure _Browser"));
+		g_signal_connect(G_OBJECT(browser_button), "clicked",
+		                 G_CALLBACK(browser_button_clicked_cb), NULL);
+		gtk_box_pack_start(GTK_BOX(hbox), browser_button, FALSE, FALSE, 0);
+		gtk_widget_show(browser_button);
 	} else {
+		vbox = pidgin_make_frame(ret, _("Proxy Server"));
+		prefs_proxy_frame = gtk_vbox_new(FALSE, 0);
+
 		pidgin_prefs_dropdown(vbox, _("Proxy _type:"), PURPLE_PREF_STRING,
 					"/purple/proxy/type",
 					_("No proxy"), "none",
@@ -1351,12 +1380,21 @@ network_page()
 		path = g_find_program_in_path("gnome-network-preferences");
 		if (path != NULL) {
 			gtk_widget_set_sensitive(proxy_button, TRUE);
-			gtk_widget_hide(warning);
+			gtk_widget_hide(proxy_warning);
 			g_free(path);
 		} else {
 			gtk_widget_set_sensitive(proxy_button, FALSE);
-			gtk_widget_show(warning);
+			gtk_widget_show(proxy_warning);
 		}
+		path = g_find_program_in_path("gnome-default-applications-properties");
+		if (path != NULL) {
+			gtk_widget_set_sensitive(browser_button, TRUE);
+			gtk_widget_hide(browser_warning);
+			g_free(path);
+		} else {
+			gtk_widget_set_sensitive(browser_button, FALSE);
+			gtk_widget_show(browser_warning);
+		}
 	}
 
 	return ret;


More information about the Commits mailing list