[Xfce4-commits] <xfce4-weather-plugin:master> Remove proxy-related stuff from configuration dialog.

Harald Judt noreply at xfce.org
Tue Nov 20 20:18:13 CET 2012


Updating branch refs/heads/master
         to a1f1a5966634853f7ba2ab5841bddbfe70ed0c3f (commit)
       from 22f7f826441c39c64ba1ca05ab57f9a03b30ad8b (commit)

commit a1f1a5966634853f7ba2ab5841bddbfe70ed0c3f
Author: Harald Judt <h.judt at gmx.at>
Date:   Tue Nov 20 20:07:57 2012 +0100

    Remove proxy-related stuff from configuration dialog.

 panel-plugin/weather-config.c |  114 +----------------------------------------
 panel-plugin/weather-config.h |    4 --
 panel-plugin/weather-search.c |   11 +---
 panel-plugin/weather-search.h |   11 +---
 4 files changed, 6 insertions(+), 134 deletions(-)

diff --git a/panel-plugin/weather-config.c b/panel-plugin/weather-config.c
index edf4c83..d727196 100644
--- a/panel-plugin/weather-config.c
+++ b/panel-plugin/weather-config.c
@@ -297,11 +297,6 @@ apply_options(xfceweather_dialog *dialog)
         g_value_unset(&value);
     }
 
-    if (data->proxy_host) {
-        g_free(data->proxy_host);
-        data->proxy_host = NULL;
-    }
-
     data->forecast_days = 
         (gint) gtk_spin_button_get_value(GTK_SPIN_BUTTON
                                          (dialog->spin_forecast_days));
@@ -312,48 +307,6 @@ apply_options(xfceweather_dialog *dialog)
     gtk_scrollbox_set_animate(GTK_SCROLLBOX(data->scrollbox),
                               data->animation_transitions);
 
-    if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialog->chk_proxy_use)))
-        data->proxy_fromenv = FALSE;
-    else
-        if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
-                                         (dialog->chk_proxy_fromenv))) {
-            data->proxy_fromenv = TRUE;
-            check_envproxy(&data->proxy_host, &data->proxy_port);
-        } else {
-            /* use provided proxy settings */
-            data->proxy_fromenv = FALSE;
-            text =
-                g_strdup(gtk_entry_get_text(GTK_ENTRY(dialog->txt_proxy_host)));
-
-            if (strlen(text) == 0) {
-                widget =
-                    gtk_message_dialog_new(NULL,
-                                           GTK_DIALOG_NO_SEPARATOR,
-                                           GTK_MESSAGE_ERROR,
-                                           GTK_BUTTONS_CLOSE,
-                                           _("Please enter proxy settings"));
-                gtk_dialog_run(GTK_DIALOG(widget));
-                gtk_widget_destroy(widget);
-
-                gtk_widget_grab_focus(dialog->txt_proxy_host);
-                g_free(text);
-                return;
-            }
-
-            data->proxy_host = g_strdup(text);
-            data->proxy_port =
-                gtk_spin_button_get_value(GTK_SPIN_BUTTON
-                                          (dialog->txt_proxy_port));
-
-            if (data->saved_proxy_host)
-                g_free(data->saved_proxy_host);
-
-            data->saved_proxy_host = g_strdup(text);
-            data->saved_proxy_port = data->proxy_port;
-
-            g_free(text);
-        }
-
     if (cb)
         cb(data);
 }
@@ -425,8 +378,7 @@ start_auto_locate(xfceweather_dialog *dialog)
 {
     gtk_widget_set_sensitive(dialog->txt_loc_name, FALSE);
     gtk_entry_set_text(GTK_ENTRY(dialog->txt_loc_name), _("Detecting..."));
-    weather_search_by_ip(dialog->wd->proxy_host, dialog->wd->proxy_port,
-                         auto_locate_cb, dialog);
+    weather_search_by_ip(auto_locate_cb, dialog);
 }
 
 
@@ -438,9 +390,7 @@ cb_findlocation(GtkButton *button,
     search_dialog *sdialog;
     gchar *loc_name;
 
-    sdialog = create_search_dialog(NULL,
-                                   dialog->wd->proxy_host,
-                                   dialog->wd->proxy_port);
+    sdialog = create_search_dialog(NULL);
 
     gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE);
     if (run_search_dialog(sdialog)) {
@@ -539,66 +489,6 @@ create_config_dialog(xfceweather_data *data,
     gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
     gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
 
-    /* proxy settings */
-    label = gtk_label_new_with_mnemonic(_("_Proxy server:"));
-    dialog->txt_proxy_host = gtk_entry_new();
-    gtk_label_set_mnemonic_widget(GTK_LABEL(label),
-                                  GTK_WIDGET(dialog->txt_proxy_host));
-    dialog->chk_proxy_use =
-        gtk_check_button_new_with_mnemonic(_("Use proxy _server"));
-    dialog->chk_proxy_fromenv =
-        gtk_check_button_new_with_mnemonic(_("Auto-detect from _environment"));
-    dialog->txt_proxy_port = gtk_spin_button_new_with_range(0, 65536, 1);
-    gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
-    gtk_size_group_add_widget(sg, label);
-
-    vbox3 = gtk_vbox_new(FALSE, BORDER);
-    gtk_box_pack_start(GTK_BOX(vbox3), dialog->chk_proxy_use, FALSE, FALSE,
-                       0);
-    gtk_box_pack_start(GTK_BOX(vbox3), dialog->chk_proxy_fromenv, FALSE,
-                       FALSE, 0);
-    hbox = gtk_hbox_new(FALSE, BORDER);
-    gtk_box_pack_start(GTK_BOX(hbox), dialog->txt_proxy_host, TRUE, TRUE, 0);
-    gtk_box_pack_start(GTK_BOX(hbox), dialog->txt_proxy_port, FALSE, FALSE,
-                       0);
-    gtk_box_pack_start(GTK_BOX(vbox3), hbox, FALSE, FALSE, 0);
-    hbox2 = gtk_hbox_new(FALSE, BORDER);
-    gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);
-    gtk_box_pack_start(GTK_BOX(hbox2), vbox3, TRUE, TRUE, 0);
-
-    gtk_box_pack_start(GTK_BOX(vbox), hbox2, FALSE, FALSE, 0);
-
-    g_signal_connect(G_OBJECT(dialog->chk_proxy_use), "toggled",
-                     G_CALLBACK(cb_toggle), dialog->txt_proxy_host);
-    g_signal_connect(G_OBJECT(dialog->chk_proxy_use), "toggled",
-                     G_CALLBACK(cb_toggle), dialog->txt_proxy_port);
-    g_signal_connect(G_OBJECT(dialog->chk_proxy_use), "toggled",
-                     G_CALLBACK(cb_toggle), dialog->chk_proxy_fromenv);
-    g_signal_connect(G_OBJECT(dialog->chk_proxy_fromenv), "toggled",
-                     G_CALLBACK(cb_not_toggle), dialog->txt_proxy_host);
-    g_signal_connect(G_OBJECT(dialog->chk_proxy_fromenv), "toggled",
-                     G_CALLBACK(cb_not_toggle), dialog->txt_proxy_port);
-
-    if (dialog->wd->saved_proxy_host != NULL) {
-        gtk_entry_set_text(GTK_ENTRY(dialog->txt_proxy_host),
-                           dialog->wd->saved_proxy_host);
-
-        gtk_spin_button_set_value(GTK_SPIN_BUTTON(dialog->txt_proxy_port),
-                                  dialog->wd->saved_proxy_port);
-    }
-    if (dialog->wd->proxy_host || dialog->wd->proxy_fromenv) {
-        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->chk_proxy_use),
-                                     TRUE);
-        if (dialog->wd->proxy_fromenv)
-            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON
-                                         (dialog->chk_proxy_fromenv), TRUE);
-    } else {
-        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->chk_proxy_use),
-                                     TRUE);
-        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->chk_proxy_use),
-                                     FALSE);
-    }
-
     /* number of days shown in forecast */
     label = gtk_label_new_with_mnemonic(_("Number of _forecast days:"));
     dialog->spin_forecast_days =
diff --git a/panel-plugin/weather-config.h b/panel-plugin/weather-config.h
index cd12776..acbad73 100644
--- a/panel-plugin/weather-config.h
+++ b/panel-plugin/weather-config.h
@@ -32,10 +32,6 @@ typedef struct {
     GtkWidget *txt_lat;
     GtkWidget *txt_lon;
     GtkWidget *txt_loc_name;
-    GtkWidget *txt_proxy_host;
-    GtkWidget *txt_proxy_port;
-    GtkWidget *chk_proxy_use;
-    GtkWidget *chk_proxy_fromenv;
     GtkWidget *spin_forecast_days;
 
     GtkWidget *tooltip_yes;
diff --git a/panel-plugin/weather-search.c b/panel-plugin/weather-search.c
index 669c826..39b5a39 100644
--- a/panel-plugin/weather-search.c
+++ b/panel-plugin/weather-search.c
@@ -184,9 +184,7 @@ pass_search_results(GtkTreeView *tree_view,
 
 
 search_dialog *
-create_search_dialog(GtkWindow *parent,
-                     gchar *proxy_host,
-                     gint proxy_port)
+create_search_dialog(GtkWindow *parent)
 {
     search_dialog *dialog;
     GtkWidget *dialog_vbox, *vbox, *hbox, *scroll, *frame;
@@ -197,9 +195,6 @@ create_search_dialog(GtkWindow *parent,
     if (!dialog)
         return NULL;
 
-    dialog->proxy_host = proxy_host;
-    dialog->proxy_port = proxy_port;
-
     dialog->dialog =
         xfce_titled_dialog_new_with_buttons(_("Search location"),
                                             parent,
@@ -381,9 +376,7 @@ cb_geolocation(SoupSession *session,
 }
 
 
-void weather_search_by_ip(const gchar *proxy_host,
-                          gint proxy_port,
-                          void (*gui_cb) (const gchar *loc_name,
+void weather_search_by_ip(void (*gui_cb) (const gchar *loc_name,
                                           const gchar *lat,
                                           const gchar *lon,
                                           const unit_systems unit_system,
diff --git a/panel-plugin/weather-search.h b/panel-plugin/weather-search.h
index f0ea79e..11f37ae 100644
--- a/panel-plugin/weather-search.h
+++ b/panel-plugin/weather-search.h
@@ -37,22 +37,15 @@ typedef struct {
     gchar *result_lon;
     gchar *result_name;
 
-    gchar *proxy_host;
-    gint proxy_port;
-
     gchar *last_search;
 } search_dialog;
 
 
-search_dialog *create_search_dialog(GtkWindow *parent,
-                                    gchar *proxy_host,
-                                    gint proxy_port);
+search_dialog *create_search_dialog(GtkWindow *parent);
 
 gboolean run_search_dialog(search_dialog *dialog);
 
-void weather_search_by_ip(const gchar *proxy_host,
-                          gint proxy_port,
-                          void (*gui_cb) (const gchar *loc_name,
+void weather_search_by_ip(void (*gui_cb) (const gchar *loc_name,
                                           const gchar *lat,
                                           const gchar *lon,
                                           const unit_systems unit_system,


More information about the Xfce4-commits mailing list