Update of /cvsroot/gaim/gaim/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1324/src
Modified Files:
proxy.c gtkprefs.c util.h util.c gtkutils.c
Log Message:
Use GNOME proxy preferences.
Works For Me. People are going to go crazy.
We'll try it out in beta.
Index: proxy.c
===================================================================
RCS file: /cvsroot/gaim/gaim/src/proxy.c,v
retrieving revision 1.137
retrieving revision 1.138
diff -u -d -p -r1.137 -r1.138
--- proxy.c 2 Sep 2005 19:47:18 -0000 1.137
+++ proxy.c 28 Oct 2005 23:12:04 -0000 1.138
@@ -183,6 +183,67 @@ gaim_global_proxy_get_info(void)
return global_proxy_info;
}
+GaimProxyInfo *
+gaim_gnome_proxy_get_info(void)
+{
+ static GaimProxyInfo info = {0, NULL, 0, NULL, NULL};
+ gchar *path;
+ if ((path = g_find_program_in_path("gconftool-2"))) {
+ gchar *tmp;
+
+ /* See whether to use a proxy. */
+ if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/use_http_proxy", &tmp,
+ NULL, NULL, NULL))
+ return gaim_global_proxy_get_info();
+ if (strcmp(tmp, "true\n")) {
+ info.type = GAIM_PROXY_NONE;
+ g_free(tmp);
+ return gaim_global_proxy_get_info();
+ }
+
+ g_free(tmp);
+ info.type = GAIM_PROXY_HTTP;
+
+ /* Free the old fields */
+ if (info.host) {
+ g_free(info.host);
+ info.host = NULL;
+ }
+ if (info.username) {
+ g_free(info.username);
+ info.username = NULL;
+ }
+ if (info.password) {
+ g_free(info.password);
+ info.password = NULL;
+ }
+
+ /* Get the new ones */
+ if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/host", &info.host,
+ NULL, NULL, NULL))
+ return gaim_global_proxy_get_info();
+ g_strchomp(info.host);
+
+ if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/authentication_user", &info.username,
+ NULL, NULL, NULL))
+ return gaim_global_proxy_get_info();
+ g_strchomp(info.username);
+
+ if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/authentication_password", &info.password,
+ NULL, NULL, NULL))
+ return gaim_global_proxy_get_info();
+ g_strchomp(info.password);
+
+ if (!g_spawn_command_line_sync("gconftool-2 -g /system/http_proxy/port", &tmp,
+ NULL, NULL, NULL))
+ return gaim_global_proxy_get_info();
+ info.port = atoi(tmp);
+
+ g_free(path);
+ return &info;
+ }
+ return gaim_global_proxy_get_info();
+}
/**************************************************************************
* Proxy API
**************************************************************************/
@@ -1806,10 +1867,12 @@ gaim_proxy_connect(GaimAccount *account,
phb = g_new0(struct PHB, 1);
- if (account == NULL || gaim_account_get_proxy_info(account) == NULL)
- phb->gpi = gaim_global_proxy_get_info();
- else
+ if (account && gaim_account_get_proxy_info(account) != NULL)
phb->gpi = gaim_account_get_proxy_info(account);
+ else if (gaim_running_gnome())
+ phb->gpi = gaim_gnome_proxy_get_info();
+ else
+ phb->gpi = gaim_global_proxy_get_info();
phb->func = func;
phb->data = data;
Index: gtkprefs.c
===================================================================
RCS file: /cvsroot/gaim/gaim/src/gtkprefs.c,v
retrieving revision 1.292
retrieving revision 1.293
diff -u -d -p -r1.292 -r1.293
--- gtkprefs.c 25 Oct 2005 13:57:23 -0000 1.292
+++ gtkprefs.c 28 Oct 2005 23:12:04 -0000 1.293
@@ -996,99 +996,101 @@ network_page()
g_signal_connect(G_OBJECT(ports_checkbox), "clicked",
G_CALLBACK(gaim_gtk_toggle_sensitive), spin_button);
- vbox = gaim_gtk_make_frame(ret, _("Proxy Server"));
- prefs_proxy_frame = gtk_vbox_new(FALSE, 0);
- gaim_gtk_prefs_dropdown(vbox, _("Proxy _type:"), GAIM_PREF_STRING,
- "/core/proxy/type",
- _("No proxy"), "none",
- "SOCKS 4", "socks4",
- "SOCKS 5", "socks5",
- "HTTP", "http",
- _("Use Environmental Settings"), "envvar",
- NULL);
- gtk_box_pack_start(GTK_BOX(vbox), prefs_proxy_frame, 0, 0, 0);
- proxy_info = gaim_global_proxy_get_info();
-
- gaim_prefs_connect_callback(prefs, "/core/proxy/type",
- proxy_changed_cb, prefs_proxy_frame);
+ if (!gaim_running_gnome()) {
+ vbox = gaim_gtk_make_frame(ret, _("Proxy Server"));
+ prefs_proxy_frame = gtk_vbox_new(FALSE, 0);
+ gaim_gtk_prefs_dropdown(vbox, _("Proxy _type:"), GAIM_PREF_STRING,
+ "/core/proxy/type",
+ _("No proxy"), "none",
+ "SOCKS 4", "socks4",
+ "SOCKS 5", "socks5",
+ "HTTP", "http",
+ _("Use Environmental Settings"), "envvar",
+ NULL);
+ gtk_box_pack_start(GTK_BOX(vbox), prefs_proxy_frame, 0, 0, 0);
+ proxy_info = gaim_global_proxy_get_info();
- table = gtk_table_new(4, 2, FALSE);
- gtk_container_set_border_width(GTK_CONTAINER(table), 0);
- gtk_table_set_col_spacings(GTK_TABLE(table), 5);
- gtk_table_set_row_spacings(GTK_TABLE(table), 10);
- gtk_container_add(GTK_CONTAINER(prefs_proxy_frame), table);
+ gaim_prefs_connect_callback(prefs, "/core/proxy/type",
+ proxy_changed_cb, prefs_proxy_frame);
+
+ table = gtk_table_new(4, 2, FALSE);
+ gtk_container_set_border_width(GTK_CONTAINER(table), 0);
+ gtk_table_set_col_spacings(GTK_TABLE(table), 5);
+ gtk_table_set_row_spacings(GTK_TABLE(table), 10);
+ gtk_container_add(GTK_CONTAINER(prefs_proxy_frame), table);
- label = gtk_label_new_with_mnemonic(_("_Host:"));
- gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
- gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0);
+ label = gtk_label_new_with_mnemonic(_("_Host:"));
+ gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
+ gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0);
- entry = gtk_entry_new();
- gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry);
- gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0);
- g_signal_connect(G_OBJECT(entry), "changed",
- G_CALLBACK(proxy_print_option), (void *)PROXYHOST);
+ entry = gtk_entry_new();
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry);
+ gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0);
+ g_signal_connect(G_OBJECT(entry), "changed",
+ G_CALLBACK(proxy_print_option), (void *)PROXYHOST);
- if (proxy_info != NULL && gaim_proxy_info_get_host(proxy_info))
- gtk_entry_set_text(GTK_ENTRY(entry),
- gaim_proxy_info_get_host(proxy_info));
+ if (proxy_info != NULL && gaim_proxy_info_get_host(proxy_info))
+ gtk_entry_set_text(GTK_ENTRY(entry),
+ gaim_proxy_info_get_host(proxy_info));
- hbox = gtk_hbox_new(TRUE, 5);
- gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
- gaim_set_accessible_label (entry, label);
+ hbox = gtk_hbox_new(TRUE, 5);
+ gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
+ gaim_set_accessible_label (entry, label);
- label = gtk_label_new_with_mnemonic(_("_Port:"));
- gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
- gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1, GTK_FILL, 0, 0, 0);
+ label = gtk_label_new_with_mnemonic(_("_Port:"));
+ gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
+ gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1, GTK_FILL, 0, 0, 0);
- entry = gtk_entry_new();
- gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry);
- gtk_table_attach(GTK_TABLE(table), entry, 3, 4, 0, 1, GTK_FILL, 0, 0, 0);
- g_signal_connect(G_OBJECT(entry), "changed",
- G_CALLBACK(proxy_print_option), (void *)PROXYPORT);
+ entry = gtk_entry_new();
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry);
+ gtk_table_attach(GTK_TABLE(table), entry, 3, 4, 0, 1, GTK_FILL, 0, 0, 0);
+ g_signal_connect(G_OBJECT(entry), "changed",
+ G_CALLBACK(proxy_print_option), (void *)PROXYPORT);
- if (proxy_info != NULL && gaim_proxy_info_get_port(proxy_info) != 0) {
- char buf[128];
- g_snprintf(buf, sizeof(buf), "%d",
+ if (proxy_info != NULL && gaim_proxy_info_get_port(proxy_info) != 0) {
+ char buf[128];
+ g_snprintf(buf, sizeof(buf), "%d",
gaim_proxy_info_get_port(proxy_info));
- gtk_entry_set_text(GTK_ENTRY(entry), buf);
- }
- gaim_set_accessible_label (entry, label);
+ gtk_entry_set_text(GTK_ENTRY(entry), buf);
+ }
+ gaim_set_accessible_label (entry, label);
- label = gtk_label_new_with_mnemonic(_("_User:"));
- gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
- gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0);
+ label = gtk_label_new_with_mnemonic(_("_User:"));
+ gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
+ gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0);
- entry = gtk_entry_new();
- gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry);
- gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 1, 2, GTK_FILL, 0, 0, 0);
- g_signal_connect(G_OBJECT(entry), "changed",
- G_CALLBACK(proxy_print_option), (void *)PROXYUSER);
+ entry = gtk_entry_new();
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry);
+ gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 1, 2, GTK_FILL, 0, 0, 0);
+ g_signal_connect(G_OBJECT(entry), "changed",
+ G_CALLBACK(proxy_print_option), (void *)PROXYUSER);
- if (proxy_info != NULL && gaim_proxy_info_get_username(proxy_info) != NULL)
- gtk_entry_set_text(GTK_ENTRY(entry),
+ if (proxy_info != NULL && gaim_proxy_info_get_username(proxy_info) != NULL)
+ gtk_entry_set_text(GTK_ENTRY(entry),
gaim_proxy_info_get_username(proxy_info));
- hbox = gtk_hbox_new(TRUE, 5);
- gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
- gaim_set_accessible_label (entry, label);
+ hbox = gtk_hbox_new(TRUE, 5);
+ gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
+ gaim_set_accessible_label (entry, label);
- label = gtk_label_new_with_mnemonic(_("Pa_ssword:"));
- gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
- gtk_table_attach(GTK_TABLE(table), label, 2, 3, 1, 2, GTK_FILL, 0, 0, 0);
+ label = gtk_label_new_with_mnemonic(_("Pa_ssword:"));
+ gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
+ gtk_table_attach(GTK_TABLE(table), label, 2, 3, 1, 2, GTK_FILL, 0, 0, 0);
- entry = gtk_entry_new();
- gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry);
- gtk_table_attach(GTK_TABLE(table), entry, 3, 4, 1, 2, GTK_FILL , 0, 0, 0);
- gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
- g_signal_connect(G_OBJECT(entry), "changed",
- G_CALLBACK(proxy_print_option), (void *)PROXYPASS);
+ entry = gtk_entry_new();
+ gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry);
+ gtk_table_attach(GTK_TABLE(table), entry, 3, 4, 1, 2, GTK_FILL , 0, 0, 0);
+ gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
+ g_signal_connect(G_OBJECT(entry), "changed",
+ G_CALLBACK(proxy_print_option), (void *)PROXYPASS);
- if (proxy_info != NULL && gaim_proxy_info_get_password(proxy_info) != NULL)
- gtk_entry_set_text(GTK_ENTRY(entry),
- gaim_proxy_info_get_password(proxy_info));
- gaim_set_accessible_label (entry, label);
+ if (proxy_info != NULL && gaim_proxy_info_get_password(proxy_info) != NULL)
+ gtk_entry_set_text(GTK_ENTRY(entry),
+ gaim_proxy_info_get_password(proxy_info));
+ gaim_set_accessible_label (entry, label);
+ }
gtk_widget_show_all(ret);
if (proxy_info == NULL ||
Index: util.h
===================================================================
RCS file: /cvsroot/gaim/gaim/src/util.h,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -d -p -r1.82 -r1.83
--- util.h 17 Sep 2005 03:00:12 -0000 1.82
+++ util.h 28 Oct 2005 23:12:04 -0000 1.83
@@ -464,6 +464,13 @@ FILE *gaim_mkstemp(char **path, gboolean
gboolean gaim_program_is_valid(const char *program);
/**
+ * Check if running Gnome.
+ *
+ * @return TRUE if running Gnome, FALSE otherwise.
+ */
+gboolean gaim_running_gnome(void);
+
+/**
* Returns the IP address from a socket file descriptor.
*
* @param fd The socket file descriptor.
Index: util.c
===================================================================
RCS file: /cvsroot/gaim/gaim/src/util.c,v
retrieving revision 1.368
retrieving revision 1.369
diff -u -d -p -r1.368 -r1.369
--- util.c 24 Oct 2005 00:31:41 -0000 1.368
+++ util.c 28 Oct 2005 23:12:04 -0000 1.369
@@ -2227,6 +2227,21 @@ gaim_program_is_valid(const char *progra
return is_valid;
}
+
+gboolean
+gaim_running_gnome(void)
+{
+ gchar *tmp = g_find_program_in_path("gnome-open");
+ if ((g_getenv("GNOME_DESKTOP_SESSION_ID") != NULL) &&
+ (tmp != NULL))
+ {
+ g_free(tmp);
+ return TRUE;
+ }
+ g_free(tmp);
+ return FALSE;
+}
+
char *
gaim_fd_get_ip(int fd)
{
Index: gtkutils.c
===================================================================
RCS file: /cvsroot/gaim/gaim/src/gtkutils.c,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -d -p -r1.121 -r1.122
--- gtkutils.c 24 Oct 2005 00:31:41 -0000 1.121
+++ gtkutils.c 28 Oct 2005 23:12:04 -0000 1.122
@@ -1349,20 +1349,6 @@ gaim_gtk_treeview_popup_menu_position_fu
#endif
}
-gboolean
-gaim_running_gnome(void)
-{
- gchar *tmp = g_find_program_in_path("gnome-open");
- if ((g_getenv("GNOME_DESKTOP_SESSION_ID") != NULL) &&
- (tmp != NULL))
- {
- g_free(tmp);
- return TRUE;
- }
- g_free(tmp);
- return FALSE;
-}
-
enum {
DND_FILE_TRANSFER,
DND_IM_IMAGE,
|