cpw.rekkanoryo.prefs_window: b76ede99: Show the Configure Proxy and Configure B...

rekkanoryo at pidgin.im rekkanoryo at pidgin.im
Mon Nov 16 01:35:43 EST 2009


-----------------------------------------------------------------
Revision: b76ede9931244fc8f0d8648abf4897d289e143a2
Ancestor: c4948f3050dff9f6d3ed6f08043c19fe3c2075c3
Author: rekkanoryo at pidgin.im
Date: 2009-11-16T06:31:17
Branch: im.pidgin.cpw.rekkanoryo.prefs_window
URL: http://d.pidgin.im/viewmtn/revision/info/b76ede9931244fc8f0d8648abf4897d289e143a2

Modified files:
        pidgin/gtkprefs.c

ChangeLog: 

Show the Configure Proxy and Configure Browser buttons if the relevant GNOME
applications can be found; otherwise show informational messages stating that
we couldn't find the applications.

-------------- next part --------------
============================================================
--- pidgin/gtkprefs.c	865c8365be32bd5b83dce299943ff0c8ab50fa9d
+++ pidgin/gtkprefs.c	9ba47e180d1c4b282bc256360d826165a515cd9a
@@ -2024,8 +2024,7 @@ browser_page(void)
 static GtkWidget *
 browser_page(void)
 {
-	GtkWidget *ret, *vbox, *hbox, *label, *entry;
-	GtkWidget *browser_warning, *browser_button;
+	GtkWidget *ret, *vbox, *hbox, *label, *entry, *browser_button;
 	GtkSizeGroup *sg;
 	GList *browsers = NULL;
 
@@ -2035,33 +2034,29 @@ browser_page(void)
 	vbox = pidgin_make_frame (ret, _("Browser Selection"));
 
 	if(purple_running_gnome()) {
-		browser_warning = hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
-		gtk_container_add(GTK_CONTAINER(vbox), hbox);
+		gchar *path = g_find_program_in_path("gnome-default-applications-properties");
 
-		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);
-		gtk_widget_show(hbox);
-
 		label = gtk_label_new(_("Browser preferences are configured in GNOME preferences"));
+		gtk_container_add(GTK_CONTAINER(vbox), hbox);
 		gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
-		gtk_widget_show(label);
 
 		hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
 		gtk_container_add(GTK_CONTAINER(vbox), hbox);
-		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);
-		gtk_widget_show(hbox);
 
-		gtk_widget_show(vbox);
-		gtk_widget_show(ret);
+		if(path == NULL) {
+			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);
+		} else {
+			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_all(ret);
 	} else {
 		sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
 	
@@ -2115,8 +2110,7 @@ proxy_page(void)
 proxy_page(void)
 {
 	GtkWidget *ret = NULL, *vbox = NULL, *hbox = NULL;
-	GtkWidget *table = NULL, *entry = NULL, *label = NULL;
-	GtkWidget *proxy_warning = NULL, *proxy_button = NULL;
+	GtkWidget *table = NULL, *entry = NULL, *label = NULL, *proxy_button = NULL;
 	PurpleProxyInfo *proxy_info;
 
 	ret = gtk_vbox_new(FALSE, PIDGIN_HIG_CAT_SPACE);
@@ -2125,33 +2119,29 @@ proxy_page(void)
 	prefs_proxy_frame = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
 
 	if(purple_running_gnome()) {
-		proxy_warning = hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
-		gtk_container_add(GTK_CONTAINER(vbox), hbox);
+		gchar *path = g_find_program_in_path("gnome-network-preferences");
 
-		label = gtk_label_new(NULL);
-		gtk_label_set_markup(GTK_LABEL(label),
-							 _("<b>Proxy 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 GNOME preferences"));
+		gtk_container_add(GTK_CONTAINER(vbox), hbox);
 		gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
-		gtk_widget_show(label);
-		gtk_widget_show(hbox);
 
 		hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
 		gtk_container_add(GTK_CONTAINER(vbox), hbox);
-		proxy_button = gtk_button_new_with_mnemonic(_("Configure _Proxy"));
-		g_signal_connect(G_OBJECT(proxy_button), "clicked",
-						 G_CALLBACK(proxy_button_clicked_cb), NULL);
-		gtk_box_pack_start(GTK_BOX(hbox), proxy_button, FALSE, FALSE, 0);
-		gtk_widget_show(proxy_button);
-		gtk_widget_show(hbox);
 
-		gtk_widget_show(vbox);
-		gtk_widget_show(ret);
+		if(path == NULL) {
+			label = gtk_label_new(NULL);
+			gtk_label_set_markup(GTK_LABEL(label),
+								 _("<b>Proxy configuration program was not found.</b>"));
+			gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+		} else {
+			proxy_button = gtk_button_new_with_mnemonic(_("Configure _Proxy"));
+			g_signal_connect(G_OBJECT(proxy_button), "clicked",
+							 G_CALLBACK(proxy_button_clicked_cb), NULL);
+			gtk_box_pack_start(GTK_BOX(hbox), proxy_button, FALSE, FALSE, 0);
+		}
+
+		gtk_widget_show_all(ret);
 	} else {
 		prefs_proxy_subframe = gtk_vbox_new(FALSE, 0);
 	


More information about the Commits mailing list