[gnome-applets/wip/muktupavels/gweather-4: 2/3] gweather: remove radar map




commit d0d1d15f99faea80f969411db11908f0e7638f02
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Fri Feb 25 23:24:39 2022 +0200

    gweather: remove radar map
    
    https://gitlab.gnome.org/GNOME/libgweather/-/commit/f10d7ef6f21d65c111629fd08af8be20aaa23375

 ...org.gnome.gnome-applets.gweather.gschema.xml.in |   5 -
 gnome-applets/gweather/gweather-dialog.c           |  82 +------------
 gnome-applets/gweather/gweather-pref.c             | 128 +--------------------
 3 files changed, 3 insertions(+), 212 deletions(-)
---
diff --git a/data/schemas/org.gnome.gnome-applets.gweather.gschema.xml.in 
b/data/schemas/org.gnome.gnome-applets.gweather.gschema.xml.in
index 4aaf983af..a99ec3631 100644
--- a/data/schemas/org.gnome.gnome-applets.gweather.gschema.xml.in
+++ b/data/schemas/org.gnome.gnome-applets.gweather.gschema.xml.in
@@ -10,11 +10,6 @@
       <summary>Update interval</summary>
       <description>The interval, in seconds, between automatic updates.</description>
     </key>
-    <key name="enable-radar-map" type="b">
-      <default>false</default>
-      <summary>Display radar map</summary>
-      <description>Fetch a radar map on each update.</description>
-    </key>
     <key name="show-notifications" type="b">
       <default>false</default>
       <summary>Show notification</summary>
diff --git a/gnome-applets/gweather/gweather-dialog.c b/gnome-applets/gweather/gweather-dialog.c
index 3179f8728..1ed83b2d5 100644
--- a/gnome-applets/gweather/gweather-dialog.c
+++ b/gnome-applets/gweather/gweather-dialog.c
@@ -47,7 +47,6 @@ struct _GWeatherDialog
   GtkWidget      *cond_sunrise;
   GtkWidget      *cond_sunset;
   GtkWidget      *cond_image;
-  GtkWidget      *radar_image;
 
   GtkWidget      *forecast_text;
   GSettings      *monospace_settings;
@@ -81,16 +80,6 @@ response_cb (GWeatherDialog *dialog,
     }
 }
 
-static void
-link_cb (GtkButton *button,
-         gpointer data)
-{
-    gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (button)),
-                   "http://www.weather.com/";,
-                   gtk_get_current_event_time (),
-                   NULL);
-}
-
 static GString *
 font_description_to_textview_css (PangoFontDescription *font_desc)
 {
@@ -176,14 +165,8 @@ gweather_dialog_create (GWeatherDialog *dialog)
   GtkWidget *cond_frame_alignment;
   GtkWidget *current_note_lbl;
   GtkWidget *forecast_note_lbl;
-  GtkWidget *radar_note_lbl;
-  GtkWidget *radar_vbox;
-  GtkWidget *radar_link_btn;
-  GtkWidget *radar_link_alignment;
   GtkWidget *forecast_hbox;
-  GtkWidget *ebox;
   GtkWidget *scrolled_window;
-  GtkWidget *imagescroll_window;
 
   gw_applet = dialog->applet;
 
@@ -198,10 +181,7 @@ gweather_dialog_create (GWeatherDialog *dialog)
   gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), 2);
   gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
 
-  if (g_settings_get_boolean (gw_applet->applet_settings, "enable-radar-map"))
-      gtk_window_set_default_size (GTK_WINDOW (dialog), 570,440);
-  else
-      gtk_window_set_default_size (GTK_WINDOW (dialog), 590, 340);
+  gtk_window_set_default_size (GTK_WINDOW (dialog), 590, 340);
 
   gtk_window_set_screen (GTK_WINDOW (dialog),
                         gtk_widget_get_screen (GTK_WIDGET (gw_applet)));
@@ -446,51 +426,6 @@ gweather_dialog_create (GWeatherDialog *dialog)
   gtk_widget_show (forecast_note_lbl);
   gtk_notebook_set_tab_label (GTK_NOTEBOOK (weather_notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK 
(weather_notebook), 1), forecast_note_lbl);
 
-  if (g_settings_get_boolean (gw_applet->applet_settings, "enable-radar-map")) {
-
-      radar_note_lbl = gtk_label_new_with_mnemonic (_("Radar Map"));
-      gtk_widget_show (radar_note_lbl);
-
-      radar_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-      gtk_widget_show (radar_vbox);
-      gtk_notebook_append_page (GTK_NOTEBOOK (weather_notebook), radar_vbox, radar_note_lbl);
-      gtk_container_set_border_width (GTK_CONTAINER (radar_vbox), 6);
-
-      dialog->radar_image = gtk_image_new ();
-      
-      imagescroll_window = gtk_scrolled_window_new (NULL, NULL);
-      gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (imagescroll_window),
-                                 GTK_POLICY_AUTOMATIC,
-                                 GTK_POLICY_AUTOMATIC);
-      gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (imagescroll_window),
-                                      GTK_SHADOW_ETCHED_IN);
-      
-      ebox = gtk_event_box_new ();
-      gtk_widget_show (ebox);
-
-      gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(imagescroll_window),ebox);
-      gtk_box_pack_start (GTK_BOX (radar_vbox), imagescroll_window, TRUE, TRUE, 0);
-      gtk_widget_show (dialog->radar_image);
-      gtk_widget_show (imagescroll_window);
-      
-      gtk_container_add (GTK_CONTAINER (ebox), dialog->radar_image);
-
-      radar_link_alignment = gtk_alignment_new (0.5, 0.5, 0, 0);
-      gtk_widget_show (radar_link_alignment);
-      gtk_box_pack_start (GTK_BOX (radar_vbox), radar_link_alignment, FALSE, FALSE, 0);
-
-      /* XXX: weather.com? is this an advert? */
-      radar_link_btn = gtk_button_new_with_mnemonic (_("_Visit Weather.com"));
-      set_access_namedesc (radar_link_btn, _("Visit Weather.com"), _("Click to Enter Weather.com"));
-      gtk_widget_set_size_request (radar_link_btn, 450, -2);
-      gtk_widget_show (radar_link_btn);
-      gtk_container_add (GTK_CONTAINER (radar_link_alignment), radar_link_btn);
-
-      g_signal_connect (G_OBJECT (radar_link_btn), "clicked",
-                        G_CALLBACK (link_cb), NULL);
-
-  }
-
   g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (response_cb), NULL);
 }
 
@@ -741,19 +676,4 @@ gweather_dialog_update (GWeatherDialog *dialog)
     }
 
   g_free (forecast);
-
-  /* Update radar map */
-  if (g_settings_get_boolean (dialog->applet->applet_settings,
-                              "enable-radar-map"))
-    {
-      GdkPixbufAnimation *radar;
-
-      radar = gweather_info_get_radar (weather_info);
-
-      if (radar)
-        {
-          gtk_image_set_from_animation (GTK_IMAGE (dialog->radar_image), radar);
-          g_object_unref (radar);
-        }
-    }
 }
diff --git a/gnome-applets/gweather/gweather-pref.c b/gnome-applets/gweather/gweather-pref.c
index 5e096547e..285632658 100644
--- a/gnome-applets/gweather/gweather-pref.c
+++ b/gnome-applets/gweather/gweather-pref.c
@@ -15,9 +15,6 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-/* Radar map on by default. */
-#define RADARMAP
-
 #ifdef HAVE_CONFIG_H
 #  include <config.h>
 #endif
@@ -47,13 +44,7 @@ struct _GWeatherPref
        GtkWidget *basic_pres_combo;
        GtkWidget *find_entry;
        GtkWidget *find_next_btn;
-       
-#ifdef RADARMAP
-       GtkWidget *basic_radar_btn;
-       GtkWidget *basic_radar_url_btn;
-       GtkWidget *basic_radar_url_hbox;
-       GtkWidget *basic_radar_url_entry;
-#endif /* RADARMAP */
+
        GtkWidget *basic_update_spin;
        GtkWidget *basic_update_btn;
        GtkWidget *tree;
@@ -119,18 +110,13 @@ gweather_pref_set_accessibility (GWeatherPref *pref)
     /* Relation between components in General page */
 
     add_atk_relation (pref->basic_update_btn, pref->basic_update_spin, ATK_RELATION_CONTROLLER_FOR);
-    add_atk_relation (pref->basic_radar_btn, pref->basic_radar_url_btn, ATK_RELATION_CONTROLLER_FOR);
-    add_atk_relation (pref->basic_radar_btn, pref->basic_radar_url_entry, ATK_RELATION_CONTROLLER_FOR);
 
     add_atk_relation (pref->basic_update_spin, pref->basic_update_btn, ATK_RELATION_CONTROLLED_BY);
-    add_atk_relation (pref->basic_radar_url_btn, pref->basic_radar_btn, ATK_RELATION_CONTROLLED_BY);
-    add_atk_relation (pref->basic_radar_url_entry, pref->basic_radar_btn, ATK_RELATION_CONTROLLED_BY);
 
     /* Accessible Name and Description for the components in Preference Dialog */
 
     set_access_namedesc (pref->tree, _("Location view"), _("Select Location from the list"));
     set_access_namedesc (pref->basic_update_spin, _("Update spin button"), _("Spinbutton for updating"));
-    set_access_namedesc (pref->basic_radar_url_entry, _("Address Entry"), _("Enter the URL"));
 }
 
 static gboolean
@@ -215,8 +201,6 @@ enum_to_string (const GValue *value,
 static gboolean update_dialog (GWeatherPref *pref)
 {
     GWeatherApplet *gw_applet = pref->applet;
-    gchar *radar_url;
-    gboolean has_radar, has_custom_radar;
 
     g_settings_bind_with_mapping (gw_applet->applet_settings, "auto-update-interval",
                                  pref->basic_update_spin, "value",
@@ -256,22 +240,6 @@ static gboolean update_dialog (GWeatherPref *pref)
                     string_to_enum, enum_to_string,
                     gweather_distance_unit_get_type, NULL);
 
-#ifdef RADARMAP
-    has_radar = g_settings_get_boolean (gw_applet->applet_settings, "enable-radar-map");
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->basic_radar_btn),
-                                has_radar);
-
-    radar_url = g_settings_get_string (gw_applet->lib_settings, "radar");
-    has_custom_radar = radar_url && *radar_url;
-                                
-    gtk_widget_set_sensitive (pref->basic_radar_url_btn, has_radar);
-    gtk_widget_set_sensitive (pref->basic_radar_url_hbox, has_radar && has_custom_radar);
-    if (radar_url)
-        gtk_entry_set_text (GTK_ENTRY (pref->basic_radar_url_entry), radar_url);
-
-    g_free(radar_url);
-#endif /* RADARMAP */
-
     return TRUE;
 }
 
@@ -436,47 +404,6 @@ static void dist_combo_changed_cb (GtkComboBox *combo, GWeatherPref *pref)
         gweather_dialog_update (GWEATHER_DIALOG (gw_applet->details_dialog));
 }
 
-static void
-radar_toggled (GtkToggleButton *button, GWeatherPref *pref)
-{
-    GWeatherApplet *gw_applet = pref->applet;
-    gboolean toggled;
-    
-    toggled = gtk_toggle_button_get_active(button);
-
-    g_settings_set_boolean (gw_applet->applet_settings, "enable-radar-map", toggled);
-
-    gtk_widget_set_sensitive (pref->basic_radar_url_btn, toggled);
-    if (toggled == FALSE || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (pref->basic_radar_url_btn)) == 
TRUE)
-            gtk_widget_set_sensitive (pref->basic_radar_url_hbox, toggled);
-}
-
-static void
-use_radar_url_toggled (GtkToggleButton *button, GWeatherPref *pref)
-{
-    GWeatherApplet *gw_applet = pref->applet;
-    gboolean toggled;
-    
-    toggled = gtk_toggle_button_get_active(button);
-
-    if (!toggled)
-      g_settings_set_string (gw_applet->lib_settings, "radar", "");
-    gtk_widget_set_sensitive (pref->basic_radar_url_hbox, toggled);
-}
-
-static gboolean
-radar_url_changed (GtkWidget *widget, GdkEventFocus *event, GWeatherPref *pref)
-{
-    GWeatherApplet *gw_applet = pref->applet;
-    gchar *text;
-
-    text = gtk_editable_get_chars (GTK_EDITABLE (widget), 0, -1);
-
-    g_settings_set_string (gw_applet->lib_settings, "radar", text);
-
-    return FALSE;
-}
-
 static void
 update_interval_changed (GtkSpinButton *button, GWeatherPref *pref)
 {
@@ -669,9 +596,6 @@ gweather_pref_create (GWeatherPref *pref)
 {
     GtkWidget *pref_vbox;
     GtkWidget *pref_notebook;
-#ifdef RADARMAP
-    GtkWidget *radar_toggle_hbox;
-#endif /* RADARMAP */
     GtkWidget *pref_basic_update_alignment;
     GtkWidget *pref_basic_update_lbl;
     GtkWidget *pref_basic_update_hbox;
@@ -681,7 +605,7 @@ gweather_pref_create (GWeatherPref *pref)
     GtkWidget *pref_loc_hbox;
     GtkWidget *pref_loc_note_lbl;
     GtkWidget *scrolled_window;
-    GtkWidget *label, *value_hbox, *tree_label;
+    GtkWidget *value_hbox, *tree_label;
     GtkTreeSelection *selection;
     GtkWidget *pref_basic_vbox;
     GtkWidget *vbox;
@@ -846,46 +770,6 @@ gweather_pref_create (GWeatherPref *pref)
        g_signal_connect (dist_combo, "changed", G_CALLBACK (dist_combo_changed_cb), pref);
        g_signal_connect (pres_combo, "changed", G_CALLBACK (pres_combo_changed_cb), pref);
 
-#ifdef RADARMAP
-    pref->basic_radar_btn = gtk_check_button_new_with_mnemonic (_("Enable _radar map"));
-    gtk_widget_show (pref->basic_radar_btn);
-    g_signal_connect (G_OBJECT (pref->basic_radar_btn), "toggled",
-                     G_CALLBACK (radar_toggled), pref);
-    
-    radar_toggle_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
-    gtk_widget_show (radar_toggle_hbox);
-    
-    label = gtk_label_new ("    ");
-    gtk_widget_show (label);
-    gtk_box_pack_start (GTK_BOX (radar_toggle_hbox), label, FALSE, FALSE, 0); 
-                                             
-    pref->basic_radar_url_btn = gtk_check_button_new_with_mnemonic (_("Use _custom address for radar map"));
-    gtk_widget_show (pref->basic_radar_url_btn);
-    gtk_box_pack_start (GTK_BOX (radar_toggle_hbox), pref->basic_radar_url_btn, FALSE, FALSE, 0);
-
-    g_signal_connect (G_OBJECT (pref->basic_radar_url_btn), "toggled",
-                     G_CALLBACK (use_radar_url_toggled), pref);
-                     
-    pref->basic_radar_url_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
-    gtk_widget_show (pref->basic_radar_url_hbox);
-
-    label = gtk_label_new ("    ");
-    gtk_widget_show (label);
-    gtk_box_pack_start (GTK_BOX (pref->basic_radar_url_hbox),
-                       label, FALSE, FALSE, 0); 
-                       
-    label = gtk_label_new_with_mnemonic (_("A_ddress:"));
-    gtk_widget_show (label);
-    gtk_box_pack_start (GTK_BOX (pref->basic_radar_url_hbox),
-                       label, FALSE, FALSE, 0); 
-    pref->basic_radar_url_entry = gtk_entry_new ();
-    gtk_widget_show (pref->basic_radar_url_entry);
-    gtk_box_pack_start (GTK_BOX (pref->basic_radar_url_hbox),
-                        pref->basic_radar_url_entry, TRUE, TRUE, 0);
-    g_signal_connect (G_OBJECT (pref->basic_radar_url_entry), "focus_out_event",
-                     G_CALLBACK (radar_url_changed), pref);
-#endif /* RADARMAP */
-
     frame = create_hig_catagory (pref_basic_vbox, _("Update"));
 
     pref_basic_update_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
@@ -927,13 +811,6 @@ gweather_pref_create (GWeatherPref *pref)
 
   gtk_box_pack_start (GTK_BOX (vbox), unit_grid, TRUE, TRUE, 0);
 
-#ifdef RADARMAP
-    gtk_box_pack_start (GTK_BOX (vbox), pref->basic_radar_btn, TRUE, TRUE, 0);
-    gtk_box_pack_start (GTK_BOX (vbox), radar_toggle_hbox, TRUE, TRUE, 0);
-    gtk_box_pack_start (GTK_BOX (vbox), pref->basic_radar_url_hbox, TRUE,
-                       TRUE, 0);
-#endif /* RADARMAP */
-
     gtk_container_add (GTK_CONTAINER (frame), vbox);
 
     pref_basic_note_lbl = gtk_label_new (_("General"));
@@ -1008,7 +885,6 @@ gweather_pref_create (GWeatherPref *pref)
 
     gweather_pref_set_accessibility (pref); 
     gtk_label_set_mnemonic_widget (GTK_LABEL (pref_basic_update_sec_lbl), pref->basic_update_spin);
-    gtk_label_set_mnemonic_widget (GTK_LABEL (label), pref->basic_radar_url_entry);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]