[gnome-system-monitor/wip/fallbacktitlebar] Added top panel with headerbar contents to fallback to



commit 6cef60a7e3ff3e62ea382789a9562fb5a149a190
Author: Robert Roth <robert roth off gmail com>
Date:   Fri Dec 13 16:57:18 2013 +0200

    Added top panel with headerbar contents to fallback to

 data/interface.ui |   37 +++++++++++++++++++++++++++++++++++++
 src/interface.cpp |   16 +++++++++++++---
 2 files changed, 50 insertions(+), 3 deletions(-)
---
diff --git a/data/interface.ui b/data/interface.ui
index af40dde..c6fd2a4 100644
--- a/data/interface.ui
+++ b/data/interface.ui
@@ -61,6 +61,43 @@
         <property name="can_focus">False</property>
         <property name="orientation">vertical</property>
         <child>
+          <object class="GtkBox" id="header_box">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="orientation">horizontal</property>
+            <property name="hexpand">True</property>
+            <property name="border_width">6</property>
+            <property name="spacing">6</property>
+            <child>
+              <object class="GtkStackSwitcher" id="stack_switcher2">
+                <property name="visible">True</property>
+                <property name="stack">stack</property>
+                <property name="halign">center</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkToggleButton" id="search_button2">
+                <property name="visible">True</property>
+                <property name="action_name">win.search</property>
+                <child>
+                  <object class="GtkImage" id="search_image2">
+                    <property name="visible">True</property>
+                    <property name="icon_size">1</property>
+                    <property name="icon_name">edit-find-symbolic</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="pack_type">end</property>
+              </packing>
+            </child>
+          </object>
+        </child> 
+        <child>
           <object class="GtkStack" id="stack">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
diff --git a/src/interface.cpp b/src/interface.cpp
index 769170e..fa3c07e 100644
--- a/src/interface.cpp
+++ b/src/interface.cpp
@@ -575,6 +575,7 @@ create_main_window (GsmApplication *app)
     GtkWidget *stack;
     GtkWidget *process_menu_button;
     GMenuModel *process_menu_model;
+    GtkWidget *header_box;
 
     int width, height, xpos, ypos;
 
@@ -602,9 +603,18 @@ create_main_window (GsmApplication *app)
     gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (process_menu_button), process_menu_model);
 
     app->end_process_button = GTK_WIDGET (gtk_builder_get_object (builder, "end_process_button"));
-
-    app->search_button = GTK_WIDGET (gtk_builder_get_object (builder, "search_button"));
-
+    header_box = GTK_WIDGET (gtk_builder_get_object(builder, "header_box"));
+    GtkSettings *gtk_settings = gtk_settings_get_default ();
+    GValue alternative_ui = G_VALUE_INIT;
+    g_value_init  (&alternative_ui, G_TYPE_BOOLEAN);
+    g_object_get_property (G_OBJECT (gtk_settings), "gtk-shell-shows-menubar", &alternative_ui);
+    if (!g_value_get_boolean (&alternative_ui)) {
+        app->search_button = GTK_WIDGET (gtk_builder_get_object (builder, "search_button"));
+        //gtk_widget_set_visible (header_box, FALSE);
+    } else {
+        app->search_button = GTK_WIDGET (gtk_builder_get_object (builder, "search_button2"));
+    }
+    
     GActionEntry win_action_entries[] = {
         { "about", on_activate_about, NULL, NULL, NULL },
         { "search", on_activate_toggle, NULL, "false", NULL },


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