[frogr] Set 'primary-toolbar' for GTK3 only, through code instead of XML



commit cc7552e1cf3505c95a0dbf3a30a0d16547361e0c
Author: Mario Sanchez Prada <msanchez igalia com>
Date:   Tue Aug 16 00:05:49 2011 +0200

    Set 'primary-toolbar' for GTK3 only, through code instead of XML

 data/gtkbuilder/frogr-main-view.xml |    3 ---
 src/frogr-main-view.c               |   10 ++++++++++
 2 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/data/gtkbuilder/frogr-main-view.xml b/data/gtkbuilder/frogr-main-view.xml
index 3d56970..37f29c8 100644
--- a/data/gtkbuilder/frogr-main-view.xml
+++ b/data/gtkbuilder/frogr-main-view.xml
@@ -194,9 +194,6 @@
           <object class="GtkToolbar" id="toolbar">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <style>
-              <class name="primary-toolbar"/>
-            </style>
             <child>
               <object class="GtkToolButton" id="add_button">
                 <property name="visible">True</property>
diff --git a/src/frogr-main-view.c b/src/frogr-main-view.c
index 316802c..c7099b9 100644
--- a/src/frogr-main-view.c
+++ b/src/frogr-main-view.c
@@ -1499,6 +1499,10 @@ frogr_main_view_init (FrogrMainView *self)
   GtkWidget *main_vbox;
 #endif
 
+#ifdef GTK_API_VERSION_3
+  GtkWidget *toolbar;
+#endif
+
   /* Init model, controller and configuration */
   priv->model = frogr_main_view_model_new ();
   priv->controller = g_object_ref (frogr_controller_get_instance ());
@@ -1561,6 +1565,12 @@ frogr_main_view_init (FrogrMainView *self)
   gtk_box_reorder_child (GTK_BOX (main_vbox), menu_bar, 0);
 #endif
 
+#ifdef GTK_API_VERSION_3
+  toolbar = GTK_WIDGET (gtk_builder_get_object (builder, "toolbar"));
+  gtk_style_context_add_class (gtk_widget_get_style_context (toolbar),
+                               GTK_STYLE_CLASS_PRIMARY_TOOLBAR);
+#endif
+
   icon_view = GTK_WIDGET (gtk_builder_get_object (builder, "icon_view"));
   priv->icon_view = icon_view;
 



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