Mercurial > pidgin
changeset 21126:68fc9d5c43f7
Add a button in preferences to launch Gnome preferred application
configuration program to set browser if running Gnome.
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Sat, 03 Nov 2007 20:20:06 +0000 |
parents | 23d046a20aa0 |
children | aed98822d825 |
files | pidgin/gtkprefs.c |
diffstat | 1 files changed, 47 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkprefs.c Sat Nov 03 20:13:51 2007 +0000 +++ b/pidgin/gtkprefs.c Sat Nov 03 20:20:06 2007 +0000 @@ -1126,13 +1126,26 @@ 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 @@ 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()) { - warning = hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); + vbox = pidgin_make_frame(ret, _("Proxy Server & Browser")); + prefs_proxy_frame = gtk_vbox_new(FALSE, 0); + + 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 @@ _("<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 @@ 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,11 +1380,20 @@ 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); } }