[gnome-panel/wip/applets/clock] clock: add widgets to ClockLocationEdit



commit 84a03d271d2a31beeb26189a606495efb09f7a08
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Fri Nov 14 21:52:20 2014 +0200

    clock: add widgets to ClockLocationEdit

 applets/clock/clock-location-edit.c  |   50 ++++++++++++++++++++++++++++++---
 applets/clock/clock-location-edit.ui |   39 +++++++++++++-------------
 2 files changed, 65 insertions(+), 24 deletions(-)
---
diff --git a/applets/clock/clock-location-edit.c b/applets/clock/clock-location-edit.c
index 4537b81..985d627 100644
--- a/applets/clock/clock-location-edit.c
+++ b/applets/clock/clock-location-edit.c
@@ -22,7 +22,19 @@
 
 struct _ClockLocationEditPrivate
 {
-        GSettings *settings;
+       GSettings *settings;
+
+       GtkWidget *ok_button;
+       GtkWidget *cancel_button;
+
+       GtkWidget *name_box;
+       GtkWidget *timezone_box;
+
+       GtkWidget *latitude_entry;
+       GtkWidget *latitude_combo;
+
+       GtkWidget *longitude_entry;
+       GtkWidget *longitude_combo;
 };
 
 G_DEFINE_TYPE_WITH_PRIVATE (ClockLocationEdit,
@@ -64,7 +76,7 @@ clock_location_edit_set_property (GObject      *object,
        switch (property_id)
        {
                case PROP_SETTINGS:
-                       settings = g_value_get_object (value);
+                       settings = g_value_get_object (value);
                        edit->priv->settings = g_object_ref (settings);
                        break;
                default:
@@ -123,8 +135,36 @@ clock_location_edit_class_init (ClockLocationEditClass *class)
                                           N_PROPERTIES,
                                           object_properties);
 
-        gtk_widget_class_set_template_from_resource (widget_class,
-                                                     CLOCK_RESOURCE_PATH "clock-location-edit.ui"
+       gtk_widget_class_set_template_from_resource (widget_class,
+                                                    CLOCK_RESOURCE_PATH "clock-location-edit.ui");
+
+       gtk_widget_class_bind_template_child_private (widget_class,
+                                                     ClockLocationEdit,
+                                                     ok_button);
+       gtk_widget_class_bind_template_child_private (widget_class,
+                                                     ClockLocationEdit,
+                                                     cancel_button);
+
+       gtk_widget_class_bind_template_child_private (widget_class,
+                                                     ClockLocationEdit,
+                                                     name_box);
+       gtk_widget_class_bind_template_child_private (widget_class,
+                                                     ClockLocationEdit,
+                                                     timezone_box);
+
+       gtk_widget_class_bind_template_child_private (widget_class,
+                                                     ClockLocationEdit,
+                                                     latitude_entry);
+       gtk_widget_class_bind_template_child_private (widget_class,
+                                                     ClockLocationEdit,
+                                                     latitude_combo);
+
+       gtk_widget_class_bind_template_child_private (widget_class,
+                                                     ClockLocationEdit,
+                                                     longitude_entry);
+       gtk_widget_class_bind_template_child_private (widget_class,
+                                                     ClockLocationEdit,
+                                                     longitude_combo);
 }
 
 static void
@@ -132,7 +172,7 @@ clock_location_edit_init (ClockLocationEdit *edit)
 {
        edit->priv = clock_location_edit_get_instance_private (edit);
 
-        gtk_widget_init_template (GTK_WIDGET (edit));
+       gtk_widget_init_template (GTK_WIDGET (edit));
 }
 
 GtkWidget *
diff --git a/applets/clock/clock-location-edit.ui b/applets/clock/clock-location-edit.ui
index 861614b..cb37e30 100644
--- a/applets/clock/clock-location-edit.ui
+++ b/applets/clock/clock-location-edit.ui
@@ -2,22 +2,23 @@
 <!-- Generated with glade 3.18.3 -->
 <interface>
   <requires lib="gtk+" version="3.12"/>
-  <template class="edit-location-window" parent="GtkDialog">
+  <template class="clock-location-edit" 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-vbox7">
+      <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_area7">
+          <object class="GtkButtonBox" id="dialog-action-area">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <child>
-              <object class="GtkButton" id="edit-location-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>
@@ -32,7 +33,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="edit-location-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>
@@ -55,14 +56,14 @@
           </packing>
         </child>
         <child>
-          <object class="GtkGrid" id="table27">
+          <object class="GtkGrid" id="grid">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="border_width">5</property>
             <property name="row_spacing">6</property>
             <property name="column_spacing">6</property>
             <child>
-              <object class="GtkBox" id="edit-location-name-box">
+              <object class="GtkBox" id="name-box">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="orientation">vertical</property>
@@ -77,7 +78,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkBox" id="edit-location-timezone-box">
+              <object class="GtkBox" id="timezone-box">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="orientation">vertical</property>
@@ -92,7 +93,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkEntry" id="edit-location-latitude-entry">
+              <object class="GtkEntry" id="latitude-entry">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="hexpand">True</property>
@@ -104,7 +105,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkComboBox" id="edit-location-latitude-combo">
+              <object class="GtkComboBox" id="latitude-combo">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="model">liststore2</property>
@@ -121,7 +122,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="label240">
+              <object class="GtkLabel" id="optional-label1">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="xalign">0</property>
@@ -136,7 +137,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="label239">
+              <object class="GtkLabel" id="optional-label2">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="xalign">0</property>
@@ -151,7 +152,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkComboBox" id="edit-location-longitude-combo">
+              <object class="GtkComboBox" id="longitude-combo">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="model">liststore1</property>
@@ -168,7 +169,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkEntry" id="edit-location-longitude-entry">
+              <object class="GtkEntry" id="longitude-entry">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="hexpand">True</property>
@@ -193,7 +194,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="label237">
+              <object class="GtkLabel" id="latitude-label">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="xalign">0</property>
@@ -207,7 +208,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="label238">
+              <object class="GtkLabel" id="longitude-label">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="xalign">0</property>
@@ -221,7 +222,7 @@
               </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="label243">
+              <object class="GtkLabel" id="description-label">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="hexpand">True</property>
@@ -265,8 +266,8 @@
       </object>
     </child>
     <action-widgets>
-      <action-widget response="-6">edit-location-cancel-button</action-widget>
-      <action-widget response="-5">edit-location-ok-button</action-widget>
+      <action-widget response="-6">cancel-button</action-widget>
+      <action-widget response="-5">ok-button</action-widget>
     </action-widgets>
   </template>
 </interface>


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