[gnome-packagekit] Make the header of gpk-application draggable



commit b09c380a2086b2b992785e8da852e6f56a8d60a5
Author: Richard Hughes <richard hughsie com>
Date:   Mon Aug 13 15:04:45 2012 +0100

    Make the header of gpk-application draggable
    
    We do this by embedding a GtkToolbar there and applying the menubar style class,
    but really we want this handled by the GtkWindow making any 'dead areas' draggable.

 data/gpk-application.ui |   12 ++++++++++++
 src/gpk-application.c   |    6 ++++++
 2 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/data/gpk-application.ui b/data/gpk-application.ui
index 0805b75..2ddc7cb 100644
--- a/data/gpk-application.ui
+++ b/data/gpk-application.ui
@@ -69,6 +69,18 @@
                 <property name="expand">False</property>
                 <property name="fill">False</property>
                 <property name="pack_type">end</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkToolbar" id="toolbar_header">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="show_arrow">False</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
                 <property name="position">2</property>
               </packing>
             </child>
diff --git a/src/gpk-application.c b/src/gpk-application.c
index 5d56c4b..bacc1dd 100644
--- a/src/gpk-application.c
+++ b/src/gpk-application.c
@@ -3259,6 +3259,7 @@ gpk_application_startup_cb (GtkApplication *application, GpkApplicationPrivate *
 	GError *error = NULL;
 	GMenuModel *menu;
 	GtkEntryCompletion *completion;
+	GtkStyleContext *context;
 	GtkTreeSelection *selection;
 	GtkWidget *main_window;
 	GtkWidget *widget;
@@ -3446,6 +3447,11 @@ gpk_application_startup_cb (GtkApplication *application, GpkApplicationPrivate *
 	/* add columns to the tree view */
 	gpk_application_packages_add_columns (priv);
 
+	/* make the header draggable */
+	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "toolbar_header"));
+	context = gtk_widget_get_style_context (widget);
+	gtk_style_context_add_class (context, GTK_STYLE_CLASS_MENUBAR);
+
 	/* set up the groups checkbox */
 	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "treeview_groups"));
 



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