Mercurial > pidgin
comparison pidgin/gtkprefs.c @ 28567:b182d2e2fcce
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.
author | John Bailey <rekkanoryo@rekkanoryo.org> |
---|---|
date | Mon, 16 Nov 2009 06:31:17 +0000 |
parents | 691562edffcd |
children | ec5316033618 |
comparison
equal
deleted
inserted
replaced
28566:691562edffcd | 28567:b182d2e2fcce |
---|---|
2022 } | 2022 } |
2023 | 2023 |
2024 static GtkWidget * | 2024 static GtkWidget * |
2025 browser_page(void) | 2025 browser_page(void) |
2026 { | 2026 { |
2027 GtkWidget *ret, *vbox, *hbox, *label, *entry; | 2027 GtkWidget *ret, *vbox, *hbox, *label, *entry, *browser_button; |
2028 GtkWidget *browser_warning, *browser_button; | |
2029 GtkSizeGroup *sg; | 2028 GtkSizeGroup *sg; |
2030 GList *browsers = NULL; | 2029 GList *browsers = NULL; |
2031 | 2030 |
2032 ret = gtk_vbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); | 2031 ret = gtk_vbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); |
2033 gtk_container_set_border_width (GTK_CONTAINER (ret), PIDGIN_HIG_BORDER); | 2032 gtk_container_set_border_width (GTK_CONTAINER (ret), PIDGIN_HIG_BORDER); |
2034 | 2033 |
2035 vbox = pidgin_make_frame (ret, _("Browser Selection")); | 2034 vbox = pidgin_make_frame (ret, _("Browser Selection")); |
2036 | 2035 |
2037 if(purple_running_gnome()) { | 2036 if(purple_running_gnome()) { |
2038 browser_warning = hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); | 2037 gchar *path = g_find_program_in_path("gnome-default-applications-properties"); |
2038 | |
2039 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); | |
2040 label = gtk_label_new(_("Browser preferences are configured in GNOME preferences")); | |
2039 gtk_container_add(GTK_CONTAINER(vbox), hbox); | 2041 gtk_container_add(GTK_CONTAINER(vbox), hbox); |
2040 | |
2041 label = gtk_label_new(NULL); | |
2042 gtk_label_set_markup(GTK_LABEL(label), | |
2043 _("<b>Browser configuration program was not found.</b>")); | |
2044 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | 2042 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
2045 | 2043 |
2046 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); | 2044 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
2047 gtk_container_add(GTK_CONTAINER(vbox), hbox); | 2045 gtk_container_add(GTK_CONTAINER(vbox), hbox); |
2048 gtk_widget_show(hbox); | 2046 |
2049 | 2047 if(path == NULL) { |
2050 label = gtk_label_new(_("Browser preferences are configured in GNOME preferences")); | 2048 label = gtk_label_new(NULL); |
2051 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | 2049 gtk_label_set_markup(GTK_LABEL(label), |
2052 gtk_widget_show(label); | 2050 _("<b>Browser configuration program was not found.</b>")); |
2053 | 2051 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
2054 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); | 2052 } else { |
2055 gtk_container_add(GTK_CONTAINER(vbox), hbox); | 2053 browser_button = gtk_button_new_with_mnemonic(_("Configure _Browser")); |
2056 browser_button = gtk_button_new_with_mnemonic(_("Configure _Browser")); | 2054 g_signal_connect(G_OBJECT(browser_button), "clicked", |
2057 g_signal_connect(G_OBJECT(browser_button), "clicked", | 2055 G_CALLBACK(browser_button_clicked_cb), NULL); |
2058 G_CALLBACK(browser_button_clicked_cb), NULL); | 2056 gtk_box_pack_start(GTK_BOX(hbox), browser_button, FALSE, FALSE, 0); |
2059 gtk_box_pack_start(GTK_BOX(hbox), browser_button, FALSE, FALSE, 0); | 2057 } |
2060 gtk_widget_show(browser_button); | 2058 |
2061 gtk_widget_show(hbox); | 2059 gtk_widget_show_all(ret); |
2062 | |
2063 gtk_widget_show(vbox); | |
2064 gtk_widget_show(ret); | |
2065 } else { | 2060 } else { |
2066 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | 2061 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
2067 | 2062 |
2068 browsers = get_available_browsers(); | 2063 browsers = get_available_browsers(); |
2069 if (browsers != NULL) { | 2064 if (browsers != NULL) { |
2113 | 2108 |
2114 static GtkWidget * | 2109 static GtkWidget * |
2115 proxy_page(void) | 2110 proxy_page(void) |
2116 { | 2111 { |
2117 GtkWidget *ret = NULL, *vbox = NULL, *hbox = NULL; | 2112 GtkWidget *ret = NULL, *vbox = NULL, *hbox = NULL; |
2118 GtkWidget *table = NULL, *entry = NULL, *label = NULL; | 2113 GtkWidget *table = NULL, *entry = NULL, *label = NULL, *proxy_button = NULL; |
2119 GtkWidget *proxy_warning = NULL, *proxy_button = NULL; | |
2120 PurpleProxyInfo *proxy_info; | 2114 PurpleProxyInfo *proxy_info; |
2121 | 2115 |
2122 ret = gtk_vbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); | 2116 ret = gtk_vbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); |
2123 gtk_container_set_border_width(GTK_CONTAINER(ret), PIDGIN_HIG_BORDER); | 2117 gtk_container_set_border_width(GTK_CONTAINER(ret), PIDGIN_HIG_BORDER); |
2124 vbox = pidgin_make_frame(ret, _("Proxy Server")); | 2118 vbox = pidgin_make_frame(ret, _("Proxy Server")); |
2125 prefs_proxy_frame = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); | 2119 prefs_proxy_frame = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
2126 | 2120 |
2127 if(purple_running_gnome()) { | 2121 if(purple_running_gnome()) { |
2128 proxy_warning = hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); | 2122 gchar *path = g_find_program_in_path("gnome-network-preferences"); |
2123 | |
2124 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); | |
2125 label = gtk_label_new(_("Proxy preferences are configured in GNOME preferences")); | |
2129 gtk_container_add(GTK_CONTAINER(vbox), hbox); | 2126 gtk_container_add(GTK_CONTAINER(vbox), hbox); |
2130 | |
2131 label = gtk_label_new(NULL); | |
2132 gtk_label_set_markup(GTK_LABEL(label), | |
2133 _("<b>Proxy configuration program was not found.</b>")); | |
2134 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | 2127 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
2135 | 2128 |
2136 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); | 2129 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
2137 gtk_container_add(GTK_CONTAINER(vbox), hbox); | 2130 gtk_container_add(GTK_CONTAINER(vbox), hbox); |
2138 | 2131 |
2139 label = gtk_label_new(_("Proxy preferences are configured in GNOME preferences")); | 2132 if(path == NULL) { |
2140 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | 2133 label = gtk_label_new(NULL); |
2141 gtk_widget_show(label); | 2134 gtk_label_set_markup(GTK_LABEL(label), |
2142 gtk_widget_show(hbox); | 2135 _("<b>Proxy configuration program was not found.</b>")); |
2143 | 2136 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
2144 hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); | 2137 } else { |
2145 gtk_container_add(GTK_CONTAINER(vbox), hbox); | 2138 proxy_button = gtk_button_new_with_mnemonic(_("Configure _Proxy")); |
2146 proxy_button = gtk_button_new_with_mnemonic(_("Configure _Proxy")); | 2139 g_signal_connect(G_OBJECT(proxy_button), "clicked", |
2147 g_signal_connect(G_OBJECT(proxy_button), "clicked", | 2140 G_CALLBACK(proxy_button_clicked_cb), NULL); |
2148 G_CALLBACK(proxy_button_clicked_cb), NULL); | 2141 gtk_box_pack_start(GTK_BOX(hbox), proxy_button, FALSE, FALSE, 0); |
2149 gtk_box_pack_start(GTK_BOX(hbox), proxy_button, FALSE, FALSE, 0); | 2142 } |
2150 gtk_widget_show(proxy_button); | 2143 |
2151 gtk_widget_show(hbox); | 2144 gtk_widget_show_all(ret); |
2152 | |
2153 gtk_widget_show(vbox); | |
2154 gtk_widget_show(ret); | |
2155 } else { | 2145 } else { |
2156 prefs_proxy_subframe = gtk_vbox_new(FALSE, 0); | 2146 prefs_proxy_subframe = gtk_vbox_new(FALSE, 0); |
2157 | 2147 |
2158 /* This is a global option that affects SOCKS4 usage even with | 2148 /* This is a global option that affects SOCKS4 usage even with |
2159 * account-specific proxy settings */ | 2149 * account-specific proxy settings */ |