[gnome-panel/wip/applets/clock] clock: fix more errors



commit 59af48b42605c4cfcdccdf49faf864f73b8f6486
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sun Nov 16 21:32:16 2014 +0200

    clock: fix more errors
    
    Adding and editing locations should work.

 applets/clock/clock-location-edit.c  |    8 ++--
 applets/clock/clock-location-edit.ui |   74 ++++++++++++++++++++++++----------
 applets/clock/clock-preferences.c    |    8 ++--
 applets/clock/clock-preferences.ui   |   74 +++++++++++++++++-----------------
 applets/clock/clock.c                |    2 +-
 5 files changed, 98 insertions(+), 68 deletions(-)
---
diff --git a/applets/clock/clock-location-edit.c b/applets/clock/clock-location-edit.c
index 99e27a9..a1e8cdd 100644
--- a/applets/clock/clock-location-edit.c
+++ b/applets/clock/clock-location-edit.c
@@ -146,6 +146,8 @@ update_cities (ClockLocationEdit *edit,
 
        g_object_unref (clock_location);
        g_list_free (locations);
+
+       gtk_widget_destroy (GTK_WIDGET (edit));
 }
 
 static void
@@ -434,7 +436,6 @@ clock_location_edit_constructor (GType                  type,
                                                                                 properties);
        edit = CLOCK_LOCATION_EDIT (object);
 
-       clock_location_edit_setup_widgets (edit);
        clock_location_edit_connect_signals (edit);
 
        return object;
@@ -449,9 +450,6 @@ clock_location_edit_finalize (GObject *object)
        edit = CLOCK_LOCATION_EDIT (object);
        priv = edit->priv;
 
-       g_clear_object (&priv->location_entry);
-       g_clear_object (&priv->timezone_combo);
-
        g_clear_object (&priv->clock_location);
        g_clear_object (&priv->settings);
 
@@ -591,6 +589,8 @@ clock_location_edit_init (ClockLocationEdit *edit)
        edit->priv = clock_location_edit_get_instance_private (edit);
 
        gtk_widget_init_template (GTK_WIDGET (edit));
+
+       clock_location_edit_setup_widgets (edit);
 }
 
 GtkWidget *
diff --git a/applets/clock/clock-location-edit.ui b/applets/clock/clock-location-edit.ui
index 3def413..d384ea1 100644
--- a/applets/clock/clock-location-edit.ui
+++ b/applets/clock/clock-location-edit.ui
@@ -2,23 +2,51 @@
 <!-- Generated with glade 3.18.3 -->
 <interface>
   <requires lib="gtk+" version="3.12"/>
-  <template class="clock-location-edit" parent="GtkDialog">
+  <object class="GtkListStore" id="liststore1">
+    <columns>
+      <!-- column-name item -->
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes">North</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">South</col>
+      </row>
+    </data>
+  </object>
+  <object class="GtkListStore" id="liststore2">
+    <columns>
+      <!-- column-name item -->
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0" translatable="yes">East</col>
+      </row>
+      <row>
+        <col id="0" translatable="yes">West</col>
+      </row>
+    </data>
+  </object>
+  <template class="ClockLocationEdit" parent="GtkDialog">
     <property name="can_focus">False</property>
     <property name="border_width">5</property>
     <property name="resizable">False</property>
     <property name="destroy_with_parent">True</property>
     <property name="type_hint">normal</property>
     <child internal-child="vbox">
-      <object class="GtkBox" id="dialog-vbox">
+      <object class="GtkBox" id="dialog_vbox">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <property name="orientation">vertical</property>
         <child internal-child="action_area">
-          <object class="GtkButtonBox" id="dialog-action-area">
+          <object class="GtkButtonBox" id="dialog_action_area">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <child>
-              <object class="GtkButton" id="cancel-button">
+              <object class="GtkButton" id="cancel_button">
                 <property name="label" translatable="yes">_Cancel</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -33,7 +61,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="ok-button">
+              <object class="GtkButton" id="ok_button">
                 <property name="label" translatable="yes">_OK</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -63,7 +91,7 @@
             <property name="row_spacing">6</property>
             <property name="column_spacing">6</property>
             <child>
-              <object class="GtkBox" id="location-box">
+              <object class="GtkBox" id="location_box">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="orientation">vertical</property>
@@ -78,7 +106,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkBox" id="timezone-box">
+              <object class="GtkBox" id="timezone_box">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="orientation">vertical</property>
@@ -93,7 +121,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkEntry" id="latitude-entry">
+              <object class="GtkEntry" id="latitude_entry">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="hexpand">True</property>
@@ -105,9 +133,10 @@
               </packing>
             </child>
             <child>
-              <object class="GtkComboBox" id="latitude-combo">
+              <object class="GtkComboBox" id="latitude_combo">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <property name="model">liststore1</property>
                 <child>
                   <object class="GtkCellRendererText" id="cellrenderertext2"/>
                   <attributes>
@@ -121,7 +150,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="optional-label1">
+              <object class="GtkLabel" id="optional_label1">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="xalign">0</property>
@@ -136,7 +165,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="optional-label2">
+              <object class="GtkLabel" id="optional_label2">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="xalign">0</property>
@@ -151,9 +180,10 @@
               </packing>
             </child>
             <child>
-              <object class="GtkComboBox" id="longitude-combo">
+              <object class="GtkComboBox" id="longitude_combo">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <property name="model">liststore2</property>
                 <child>
                   <object class="GtkCellRendererText" id="cellrenderertext1"/>
                   <attributes>
@@ -167,7 +197,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkEntry" id="longitude-entry">
+              <object class="GtkEntry" id="longitude_entry">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="hexpand">True</property>
@@ -179,7 +209,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="location-label">
+              <object class="GtkLabel" id="location_label">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="xalign">0</property>
@@ -192,13 +222,13 @@
               </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="latitude-label">
+              <object class="GtkLabel" id="latitude_label">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="xalign">0</property>
                 <property name="label" translatable="yes">L_atitude:</property>
                 <property name="use_underline">True</property>
-                <property name="mnemonic_widget">latitude-entry</property>
+                <property name="mnemonic_widget">latitude_entry</property>
               </object>
               <packing>
                 <property name="left_attach">0</property>
@@ -206,13 +236,13 @@
               </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="longitude-label">
+              <object class="GtkLabel" id="longitude_label">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="xalign">0</property>
                 <property name="label" translatable="yes">L_ongitude:</property>
                 <property name="use_underline">True</property>
-                <property name="mnemonic_widget">longitude-entry</property>
+                <property name="mnemonic_widget">longitude_entry</property>
               </object>
               <packing>
                 <property name="left_attach">0</property>
@@ -220,7 +250,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="description-label">
+              <object class="GtkLabel" id="description_label">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="hexpand">True</property>
@@ -239,7 +269,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="timezone-label">
+              <object class="GtkLabel" id="timezone_label">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="xalign">0</property>
@@ -264,8 +294,8 @@
       </object>
     </child>
     <action-widgets>
-      <action-widget response="-6">cancel-button</action-widget>
-      <action-widget response="-5">ok-button</action-widget>
+      <action-widget response="-6">cancel_button</action-widget>
+      <action-widget response="-5">ok_button</action-widget>
     </action-widgets>
   </template>
 </interface>
diff --git a/applets/clock/clock-preferences.c b/applets/clock/clock-preferences.c
index f60bae2..9bdf1b4 100644
--- a/applets/clock/clock-preferences.c
+++ b/applets/clock/clock-preferences.c
@@ -32,8 +32,8 @@ struct _ClockPreferencesPrivate
        GtkWidget *close_button;
 
        /* General */
-       GtkWidget *12hr_radio;
-       GtkWidget *24hr_radio;
+       GtkWidget *clock_format_12hr;
+       GtkWidget *clock_format_24hr;
        GtkWidget *show_date;
        GtkWidget *show_seconds;
        GtkWidget *show_weather;
@@ -165,10 +165,10 @@ clock_preferences_class_init (ClockPreferencesClass *class)
 
        gtk_widget_class_bind_template_child_private (widget_class,
                                                      ClockPreferences,
-                                                     12hr_radio);
+                                                     clock_format_12hr);
        gtk_widget_class_bind_template_child_private (widget_class,
                                                      ClockPreferences,
-                                                     24hr_radio);
+                                                     clock_format_24hr);
        gtk_widget_class_bind_template_child_private (widget_class,
                                                      ClockPreferences,
                                                      show_date);
diff --git a/applets/clock/clock-preferences.ui b/applets/clock/clock-preferences.ui
index 9b2584c..16f90f0 100644
--- a/applets/clock/clock-preferences.ui
+++ b/applets/clock/clock-preferences.ui
@@ -2,7 +2,7 @@
 <!-- Generated with glade 3.18.3 -->
 <interface>
   <requires lib="gtk+" version="3.12"/>
-  <template class="clock-preferences" parent="GtkDialog">
+  <template class="ClockPreferences" parent="GtkDialog">
     <property name="can_focus">False</property>
     <property name="border_width">5</property>
     <property name="title" translatable="yes">Clock Preferences</property>
@@ -11,17 +11,17 @@
     <property name="destroy_with_parent">True</property>
     <property name="type_hint">dialog</property>
     <child internal-child="vbox">
-      <object class="GtkBox" id="dialog-vbox">
+      <object class="GtkBox" id="dialog_vbox">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <property name="orientation">vertical</property>
         <property name="spacing">2</property>
         <child internal-child="action_area">
-          <object class="GtkButtonBox" id="dialog-action-area">
+          <object class="GtkButtonBox" id="dialog_action_area">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <child>
-              <object class="GtkButton" id="help-button">
+              <object class="GtkButton" id="help_button">
                 <property name="label" translatable="yes">_Help</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -36,7 +36,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="time-settings-button">
+              <object class="GtkButton" id="time_settings_button">
                 <property name="label" translatable="yes">Time _Settings</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -51,7 +51,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="close-button">
+              <object class="GtkButton" id="close_button">
                 <property name="label" translatable="yes">_Close</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -87,13 +87,13 @@
                 <property name="orientation">vertical</property>
                 <property name="spacing">18</property>
                 <child>
-                  <object class="GtkBox" id="clock-options">
+                  <object class="GtkBox" id="clock_options">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="orientation">vertical</property>
                     <property name="spacing">6</property>
                     <child>
-                      <object class="GtkLabel" id="clock-format-label">
+                      <object class="GtkLabel" id="clock_format_label">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="xalign">0</property>
@@ -116,7 +116,7 @@
                         <property name="margin_start">12</property>
                         <property name="spacing">13</property>
                         <child>
-                          <object class="GtkRadioButton" id="12hr-radio">
+                          <object class="GtkRadioButton" id="clock_format_12hr">
                             <property name="label" translatable="yes">_12 hour format</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
@@ -134,7 +134,7 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkRadioButton" id="24hr-radio">
+                          <object class="GtkRadioButton" id="clock_format_24hr">
                             <property name="label" translatable="yes">_24 hour format</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
@@ -143,7 +143,7 @@
                             <property name="use_underline">True</property>
                             <property name="xalign">0</property>
                             <property name="draw_indicator">True</property>
-                            <property name="group">12hr_radio</property>
+                            <property name="group">clock_format_12hr</property>
                           </object>
                           <packing>
                             <property name="expand">False</property>
@@ -166,13 +166,13 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkBox" id="panel-display">
+                  <object class="GtkBox" id="panel_display">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="orientation">vertical</property>
                     <property name="spacing">6</property>
                     <child>
-                      <object class="GtkLabel" id="panel-display-label">
+                      <object class="GtkLabel" id="panel_display_label">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="xalign">0</property>
@@ -196,7 +196,7 @@
                         <property name="orientation">vertical</property>
                         <property name="spacing">6</property>
                         <child>
-                          <object class="GtkCheckButton" id="show-date">
+                          <object class="GtkCheckButton" id="show_date">
                             <property name="label" translatable="yes">Show the _date</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
@@ -213,7 +213,7 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkCheckButton" id="show-seconds">
+                          <object class="GtkCheckButton" id="show_seconds">
                             <property name="label" translatable="yes">Show seco_nds</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
@@ -230,7 +230,7 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkCheckButton" id="show-weather">
+                          <object class="GtkCheckButton" id="show_weather">
                             <property name="label" translatable="yes">Show _weather</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
@@ -247,7 +247,7 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkCheckButton" id="show-temperature">
+                          <object class="GtkCheckButton" id="show_temperature">
                             <property name="label" translatable="yes">Show _temperature</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
@@ -280,7 +280,7 @@
               </object>
             </child>
             <child type="tab">
-              <object class="GtkLabel" id="general-label">
+              <object class="GtkLabel" id="general_label">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="label" translatable="yes">General</property>
@@ -309,14 +309,14 @@
                         <property name="vscrollbar_policy">never</property>
                         <property name="shadow_type">in</property>
                         <child>
-                          <object class="GtkTreeView" id="cities-list">
+                          <object class="GtkTreeView" id="cities_list">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
                             <property name="vexpand">True</property>
                             <property name="headers_visible">False</property>
                             <property name="hover_expand">True</property>
                             <child internal-child="selection">
-                              <object class="GtkTreeSelection" id="treeview-selection3"/>
+                              <object class="GtkTreeSelection" id="treeview_selection3"/>
                             </child>
                           </object>
                         </child>
@@ -335,7 +335,7 @@
                         <property name="spacing">6</property>
                         <property name="layout_style">start</property>
                         <child>
-                          <object class="GtkButton" id="add-button">
+                          <object class="GtkButton" id="add_button">
                             <property name="label" translatable="yes">_Add</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
@@ -350,7 +350,7 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkButton" id="edit-button">
+                          <object class="GtkButton" id="edit_button">
                             <property name="label" translatable="yes">_Edit</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
@@ -365,7 +365,7 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkButton" id="remove-button">
+                          <object class="GtkButton" id="remove_button">
                             <property name="label" translatable="yes">_Remove</property>
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
@@ -399,7 +399,7 @@
               </packing>
             </child>
             <child type="tab">
-              <object class="GtkLabel" id="locations-label">
+              <object class="GtkLabel" id="locations_label">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="label" translatable="yes">Locations</property>
@@ -423,7 +423,7 @@
                     <property name="orientation">vertical</property>
                     <property name="spacing">6</property>
                     <child>
-                      <object class="GtkLabel" id="display-label">
+                      <object class="GtkLabel" id="display_label">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="xalign">0</property>
@@ -447,7 +447,7 @@
                         <property name="row_spacing">6</property>
                         <property name="column_spacing">12</property>
                         <child>
-                          <object class="GtkComboBox" id="visibility-combo">
+                          <object class="GtkComboBox" id="visibility_combo">
                             <property name="can_focus">False</property>
                             <property name="hexpand">True</property>
                           </object>
@@ -457,7 +457,7 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkLabel" id="visibility-label">
+                          <object class="GtkLabel" id="visibility_label">
                             <property name="can_focus">False</property>
                             <property name="xalign">0</property>
                             <property name="label" translatable="yes">_Visibility unit:</property>
@@ -470,7 +470,7 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkComboBox" id="pressure-combo">
+                          <object class="GtkComboBox" id="pressure_combo">
                             <property name="can_focus">False</property>
                             <property name="hexpand">True</property>
                           </object>
@@ -480,7 +480,7 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkLabel" id="pressure-label">
+                          <object class="GtkLabel" id="pressure_label">
                             <property name="can_focus">False</property>
                             <property name="xalign">0</property>
                             <property name="label" translatable="yes">_Pressure unit:</property>
@@ -493,7 +493,7 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkComboBox" id="wind-speed-combo">
+                          <object class="GtkComboBox" id="wind_speed_combo">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="hexpand">True</property>
@@ -504,7 +504,7 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkComboBox" id="temperature-combo">
+                          <object class="GtkComboBox" id="temperature_combo">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="hexpand">True</property>
@@ -515,7 +515,7 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkLabel" id="temperature-label">
+                          <object class="GtkLabel" id="temperature_label">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="xalign">0</property>
@@ -529,7 +529,7 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkLabel" id="wind-speed-label">
+                          <object class="GtkLabel" id="wind_speed_label">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="xalign">0</property>
@@ -562,7 +562,7 @@
               </packing>
             </child>
             <child type="tab">
-              <object class="GtkLabel" id="weather-label">
+              <object class="GtkLabel" id="weather_label">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="label" translatable="yes">Weather</property>
@@ -582,9 +582,9 @@
       </object>
     </child>
     <action-widgets>
-      <action-widget response="-11">help-button</action-widget>
-      <action-widget response="0">time-settings-button</action-widget>
-      <action-widget response="-7">close-button</action-widget>
+      <action-widget response="-11">help_button</action-widget>
+      <action-widget response="0">time_settings_button</action-widget>
+      <action-widget response="-7">close_button</action-widget>
     </action-widgets>
   </template>
 </interface>
diff --git a/applets/clock/clock.c b/applets/clock/clock.c
index 565b25c..3f03966 100644
--- a/applets/clock/clock.c
+++ b/applets/clock/clock.c
@@ -637,7 +637,7 @@ static void
 create_cities_section (ClockData *cd)
 {
         GList *node;
-        ClockLocationTile *city;
+        GtkWidget *city;
         GList *cities;
 
         if (cd->cities_section) {


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