[gnome-packagekit] Move the selection items into actual buttons



commit 318476db8e246593335ba43c849b58dde36323fc
Author: Richard Hughes <richard hughsie com>
Date:   Fri May 11 13:35:13 2012 +0100

    Move the selection items into actual buttons

 data/gpk-application.ui |  313 ++++++++++++++++++++++++++++++-----------------
 src/gpk-application.c   |   79 +++++--------
 2 files changed, 230 insertions(+), 162 deletions(-)
---
diff --git a/data/gpk-application.ui b/data/gpk-application.ui
index 9b386b3..3c2954b 100644
--- a/data/gpk-application.ui
+++ b/data/gpk-application.ui
@@ -59,98 +59,6 @@
           </packing>
         </child>
         <child>
-          <object class="GtkMenuBar" id="menubar1">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-            <child>
-              <object class="GtkMenuItem" id="menuitem_selection">
-                <property name="use_action_appearance">False</property>
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label" translatable="yes">S_election</property>
-                <property name="use_underline">True</property>
-                <child type="submenu">
-                  <object class="GtkMenu" id="menu9">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <child>
-                      <object class="GtkMenuItem" id="menuitem_install">
-                        <property name="use_action_appearance">False</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Install</property>
-                        <property name="use_underline">True</property>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkMenuItem" id="menuitem_remove">
-                        <property name="use_action_appearance">False</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Remove</property>
-                        <property name="use_underline">True</property>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkMenuItem" id="menuitem_homepage">
-                        <property name="use_action_appearance">False</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="tooltip_text" translatable="yes">Visit the project homepage</property>
-                        <property name="label" translatable="yes">Project homepage</property>
-                        <property name="use_underline">True</property>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkMenuItem" id="menuitem_run">
-                        <property name="use_action_appearance">False</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="tooltip_text" translatable="yes">Execute graphical applications</property>
-                        <property name="label" translatable="yes">Run program</property>
-                        <property name="use_underline">True</property>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkMenuItem" id="menuitem_files">
-                        <property name="use_action_appearance">False</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Get file list</property>
-                        <property name="use_underline">True</property>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkMenuItem" id="menuitem_depends">
-                        <property name="use_action_appearance">False</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Depends on</property>
-                        <property name="use_underline">True</property>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkMenuItem" id="menuitem_requires">
-                        <property name="use_action_appearance">False</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Required by</property>
-                        <property name="use_underline">True</property>
-                      </object>
-                    </child>
-                  </object>
-                </child>
-              </object>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-        <child>
           <object class="GtkHBox" id="hbox1">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
@@ -283,21 +191,56 @@
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="spacing">6</property>
-                                <property name="homogeneous">True</property>
                                 <child>
-                                  <object class="GtkScrolledWindow" id="scrolledwindow2">
+                                  <object class="GtkBox" id="box2">
                                     <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="shadow_type">in</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="orientation">vertical</property>
+                                    <property name="spacing">6</property>
                                     <child>
-                                      <object class="GtkTextView" id="textview_description">
+                                      <object class="GtkScrolledWindow" id="scrolledwindow2">
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
-                                        <property name="border_width">2</property>
-                                        <property name="editable">False</property>
-                                        <property name="wrap_mode">word</property>
-                                        <property name="cursor_visible">False</property>
+                                        <property name="shadow_type">in</property>
+                                        <child>
+                                          <object class="GtkTextView" id="textview_description">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="border_width">2</property>
+                                            <property name="editable">False</property>
+                                            <property name="wrap_mode">word</property>
+                                            <property name="cursor_visible">False</property>
+                                          </object>
+                                        </child>
                                       </object>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="fill">True</property>
+                                        <property name="position">0</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <object class="GtkScrolledWindow" id="scrolledwindow_detail">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="vscrollbar_policy">never</property>
+                                        <property name="shadow_type">in</property>
+                                        <child>
+                                          <object class="GtkTreeView" id="treeview_detail">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="headers_visible">False</property>
+                                            <child internal-child="selection">
+                                              <object class="GtkTreeSelection" id="treeview-selection"/>
+                                            </child>
+                                          </object>
+                                        </child>
+                                      </object>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="fill">True</property>
+                                        <property name="position">1</property>
+                                      </packing>
                                     </child>
                                   </object>
                                   <packing>
@@ -307,32 +250,176 @@
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkScrolledWindow" id="scrolledwindow_detail">
+                                  <object class="GtkButtonBox" id="buttonbox_selection">
                                     <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="vscrollbar_policy">never</property>
-                                    <property name="shadow_type">in</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="orientation">vertical</property>
+                                    <property name="layout_style">start</property>
                                     <child>
-                                      <object class="GtkTreeView" id="treeview_detail">
+                                      <object class="GtkButton" id="button_install">
+                                        <property name="use_action_appearance">False</property>
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
-                                        <property name="headers_visible">False</property>
-                                        <child internal-child="selection">
-                                          <object class="GtkTreeSelection" id="treeview-selection3"/>
+                                        <property name="receives_default">True</property>
+                                        <property name="use_action_appearance">False</property>
+                                        <child>
+                                          <object class="GtkLabel" id="label1">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="xalign">0</property>
+                                            <property name="label" translatable="yes">Install Package</property>
+                                          </object>
                                         </child>
                                       </object>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="fill">True</property>
+                                        <property name="position">0</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <object class="GtkButton" id="button_remove">
+                                        <property name="use_action_appearance">False</property>
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="receives_default">True</property>
+                                        <property name="use_action_appearance">False</property>
+                                        <child>
+                                          <object class="GtkLabel" id="label2">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="xalign">0</property>
+                                            <property name="label" translatable="yes">Remove Package</property>
+                                          </object>
+                                        </child>
+                                      </object>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="fill">True</property>
+                                        <property name="position">1</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <object class="GtkButton" id="button_homepage">
+                                        <property name="use_action_appearance">False</property>
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="receives_default">True</property>
+                                        <property name="use_action_appearance">False</property>
+                                        <child>
+                                          <object class="GtkLabel" id="label3">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="xalign">0</property>
+                                            <property name="label" translatable="yes">Visit Project Website</property>
+                                          </object>
+                                        </child>
+                                      </object>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="fill">True</property>
+                                        <property name="position">2</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <object class="GtkButton" id="button_files">
+                                        <property name="use_action_appearance">False</property>
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="receives_default">True</property>
+                                        <property name="use_action_appearance">False</property>
+                                        <child>
+                                          <object class="GtkLabel" id="label4">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="xalign">0</property>
+                                            <property name="label" translatable="yes">Files</property>
+                                          </object>
+                                        </child>
+                                      </object>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="fill">True</property>
+                                        <property name="position">3</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <object class="GtkButton" id="button_requires">
+                                        <property name="use_action_appearance">False</property>
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="receives_default">True</property>
+                                        <property name="use_action_appearance">False</property>
+                                        <child>
+                                          <object class="GtkLabel" id="label5">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="xalign">0</property>
+                                            <property name="label" translatable="yes">Required Packages</property>
+                                          </object>
+                                        </child>
+                                      </object>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="fill">True</property>
+                                        <property name="position">4</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <object class="GtkButton" id="button_depends">
+                                        <property name="use_action_appearance">False</property>
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="receives_default">True</property>
+                                        <property name="use_action_appearance">False</property>
+                                        <child>
+                                          <object class="GtkLabel" id="label6">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="xalign">0</property>
+                                            <property name="label" translatable="yes">Dependent Packages</property>
+                                          </object>
+                                        </child>
+                                      </object>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="fill">True</property>
+                                        <property name="position">5</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <object class="GtkButton" id="button_run">
+                                        <property name="use_action_appearance">False</property>
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="receives_default">True</property>
+                                        <property name="use_action_appearance">False</property>
+                                        <child>
+                                          <object class="GtkLabel" id="label7">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="xalign">0</property>
+                                            <property name="label" translatable="yes">Run Program</property>
+                                          </object>
+                                        </child>
+                                      </object>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="fill">True</property>
+                                        <property name="position">6</property>
+                                      </packing>
                                     </child>
                                   </object>
                                   <packing>
-                                    <property name="expand">True</property>
-                                    <property name="fill">True</property>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
                                     <property name="position">1</property>
                                   </packing>
                                 </child>
                               </object>
                               <packing>
                                 <property name="expand">False</property>
-                                <property name="fill">False</property>
+                                <property name="fill">True</property>
                                 <property name="position">1</property>
                               </packing>
                             </child>
@@ -415,7 +502,7 @@
             <property name="expand">True</property>
             <property name="fill">True</property>
             <property name="padding">6</property>
-            <property name="position">2</property>
+            <property name="position">1</property>
           </packing>
         </child>
       </object>
diff --git a/src/gpk-application.c b/src/gpk-application.c
index 4fec634..df6b159 100644
--- a/src/gpk-application.c
+++ b/src/gpk-application.c
@@ -216,8 +216,8 @@ static void
 gpk_application_allow_install (GpkApplicationPrivate *priv, gboolean allow)
 {
 	GtkWidget *widget;
-	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "menuitem_install"));
-	gtk_widget_set_sensitive (widget, allow);
+	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_install"));
+	gtk_widget_set_visible (widget, allow);
 }
 
 /**
@@ -227,8 +227,8 @@ static void
 gpk_application_allow_remove (GpkApplicationPrivate *priv, gboolean allow)
 {
 	GtkWidget *widget;
-	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "menuitem_remove"));
-	gtk_widget_set_sensitive (widget, allow);
+	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_remove"));
+	gtk_widget_set_visible (widget, allow);
 }
 
 /**
@@ -2253,25 +2253,10 @@ gpk_application_get_details_cb (PkClient *client, GAsyncResult *res, GpkApplicat
 		gpk_application_add_detail_item (priv, _("Type"), _("Collection"), NULL);
 
 	/* homepage */
-	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "menuitem_homepage"));
-	if (egg_strzero (url) == FALSE) {
-		gtk_widget_set_sensitive (widget, TRUE);
-
-		/* TRANSLATORS: tooltip: go to the web address */
-		text = g_strdup_printf (_("Visit %s"), url);
-		gtk_widget_set_tooltip_text (widget, text);
-		g_free (text);
-
-		/* TRANSLATORS: add an entry to go to the project home page */
-		gpk_application_add_detail_item (priv, _("Project"), _("Homepage"), url);
-
-		/* save the url for the button */
-		g_free (priv->homepage_url);
-		priv->homepage_url = g_strdup (url);
-
-	} else {
-		gtk_widget_set_sensitive (widget, FALSE);
-	}
+	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_homepage"));
+	g_free (priv->homepage_url);
+	priv->homepage_url = g_strdup (url);
+	gtk_widget_set_visible (widget, url != NULL);
 
 	/* group */
 	if (group != PK_GROUP_ENUM_UNKNOWN) {
@@ -2352,7 +2337,7 @@ gpk_application_packages_treeview_clicked_cb (GtkTreeSelection *selection, GpkAp
 		/* we cannot now add it */
 		gpk_application_allow_install (priv, FALSE);
 		gpk_application_allow_remove (priv, FALSE);
-		widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "menuitem_selection"));
+		widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "hbox_packages"));
 		gtk_widget_hide (widget);
 
 		/* hide details */
@@ -2371,7 +2356,7 @@ gpk_application_packages_treeview_clicked_cb (GtkTreeSelection *selection, GpkAp
 	}
 
 	/* show the menu item */
-	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "menuitem_selection"));
+	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "hbox_packages"));
 	gtk_widget_show (widget);
 
 	show_install = (state == 0 ||
@@ -2393,8 +2378,8 @@ gpk_application_packages_treeview_clicked_cb (GtkTreeSelection *selection, GpkAp
 
 	/* only show run menuitem for installed programs */
 	ret = pk_bitfield_contain (state, GPK_STATE_INSTALLED);
-	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "menuitem_run"));
-	gtk_widget_set_sensitive (widget, ret);
+	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_run"));
+	gtk_widget_set_visible (widget, ret);
 
 	/* ensure new action succeeds */
 	g_cancellable_reset (priv->cancellable);
@@ -3180,15 +3165,15 @@ pk_backend_status_get_properties_cb (GObject *object, GAsyncResult *res, GpkAppl
 		gtk_widget_hide (widget);
 	}
 	if (pk_bitfield_contain (priv->roles, PK_ROLE_ENUM_GET_FILES) == FALSE) {
-		widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "menuitem_files"));
+		widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_files"));
 		gtk_widget_hide (widget);
 	}
 	if (pk_bitfield_contain (priv->roles, PK_ROLE_ENUM_GET_DEPENDS) == FALSE) {
-		widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "menuitem_depends"));
+		widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_depends"));
 		gtk_widget_hide (widget);
 	}
 	if (pk_bitfield_contain (priv->roles, PK_ROLE_ENUM_GET_REQUIRES) == FALSE) {
-		widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "menuitem_requires"));
+		widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_requires"));
 		gtk_widget_hide (widget);
 	}
 
@@ -3463,37 +3448,37 @@ gpk_application_startup_cb (GtkApplication *application, GpkApplicationPrivate *
 	/* TRANSLATORS: tooltip on the apply button */
 	gtk_widget_set_tooltip_text (widget, _("Changes are not applied instantly, this button applies all changes"));
 
-	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "menuitem_homepage"));
-	g_signal_connect (widget, "activate",
+	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_homepage"));
+	g_signal_connect (widget, "clicked",
 			  G_CALLBACK (gpk_application_menu_homepage_cb), priv);
 	/* TRANSLATORS: tooltip on the homepage button */
 	gtk_widget_set_tooltip_text (widget, _("Visit home page for selected package"));
 
-	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "menuitem_files"));
-	g_signal_connect (widget, "activate",
+	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_files"));
+	g_signal_connect (widget, "clicked",
 			  G_CALLBACK (gpk_application_menu_files_cb), priv);
 
-	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "menuitem_install"));
-	g_signal_connect (widget, "activate",
+	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_install"));
+	g_signal_connect (widget, "clicked",
 			  G_CALLBACK (gpk_application_menu_install_cb), priv);
 
-	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "menuitem_remove"));
-	g_signal_connect (widget, "activate",
+	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_remove"));
+	g_signal_connect (widget, "clicked",
 			  G_CALLBACK (gpk_application_menu_remove_cb), priv);
 
-	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "menuitem_depends"));
-	g_signal_connect (widget, "activate",
+	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_depends"));
+	g_signal_connect (widget, "clicked",
 			  G_CALLBACK (gpk_application_menu_depends_cb), priv);
 
-	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "menuitem_requires"));
-	g_signal_connect (widget, "activate",
+	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_requires"));
+	g_signal_connect (widget, "clicked",
 			  G_CALLBACK (gpk_application_menu_requires_cb), priv);
 
-	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "menuitem_run"));
-	g_signal_connect (widget, "activate",
+	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_run"));
+	g_signal_connect (widget, "clicked",
 			  G_CALLBACK (gpk_application_menu_run_cb), priv);
 
-	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "menuitem_selection"));
+	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "hbox_packages"));
 	gtk_widget_hide (widget);
 
 	/* search cancel button */
@@ -3540,10 +3525,6 @@ gpk_application_startup_cb (GtkApplication *application, GpkApplicationPrivate *
 	gtk_window_maximize (GTK_WINDOW (main_window));
 	gtk_widget_show (GTK_WIDGET(main_window));
 
-	/* set details box decent size */
-	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "hbox_packages"));
-	gtk_widget_set_size_request (widget, -1, 120);
-
 	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "treeview_packages"));
 	gtk_tree_view_columns_autosize (GTK_TREE_VIEW (widget));
 	g_signal_connect (GTK_TREE_VIEW (widget), "row-activated",



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