[totem] playlist: Use toolbar instead of button bar



commit 8bc05fac46fec63ce647187a6059173da2326de2
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Jan 27 17:15:36 2011 +0000

    playlist: Use toolbar instead of button bar
    
    This means less glade garbage, and using symbolic icons.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=636964

 data/playlist.ui     |  401 +++++++++++++++++---------------------------------
 src/totem-playlist.c |   10 ++
 2 files changed, 145 insertions(+), 266 deletions(-)
---
diff --git a/data/playlist.ui b/data/playlist.ui
index d936ce4..888d0b8 100644
--- a/data/playlist.ui
+++ b/data/playlist.ui
@@ -1,4 +1,4 @@
-<?xml version="1.0" ?>
+<?xml version="1.0" encoding="UTF-8"?>
 <interface>
 
 <object class="GtkUIManager" id="totem-playlist-ui-manager">
@@ -39,269 +39,138 @@
    </ui>
 </object>
 
-<object class="GtkListStore" id="playlist_list_store">
-  <columns>
-    <column type="gint"/><!--playing-->
-    <column type="gchararray"/><!--filename-->
-    <column type="gchararray"/><!--escaped filename-->
-    <column type="gchararray"/><!--URI-->
-    <column type="gboolean"/><!--custom title-->
-    <column type="gchararray"/><!--subtitle URI-->
-    <column type="GObject"/><!--file monitor-->
-  </columns>
-</object>
-
-<object class="GtkVBox" id="vbox4">
-  <property name="border_width">0</property>
-  <property name="visible">True</property>
-  <property name="homogeneous">False</property>
-  <property name="spacing">6</property>
-  <property name="orientation">vertical</property>
-
-  <child>
-    <object class="GtkScrolledWindow" id="scrolledwindow1">
-      <property name="visible">True</property>
-      <property name="can_focus">True</property>
-      <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-      <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-      <property name="shadow_type">GTK_SHADOW_IN</property>
-      <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
-
-      <child>
-	<object class="GtkTreeView" id="treeview1">
-	  <property name="model">playlist_list_store</property>
-	  <property name="visible">True</property>
-	  <property name="can-focus">True</property>
-	  <property name="headers-visible">False</property>
-	  <property name="rules-hint">True</property>
-	  <property name="reorderable">False</property>
-	  <property name="enable-search">True</property>
-	  <property name="fixed-height-mode">False</property>
-	  <property name="hover-selection">False</property>
-	  <property name="hover-expand">False</property>
-	</object>
-      </child>
-    </object>
-    <packing>
-      <property name="padding">0</property>
-      <property name="expand">True</property>
-      <property name="fill">True</property>
-    </packing>
-  </child>
-
-  <child>
-    <object class="GtkHBox" id="hbox4">
-      <property name="visible">True</property>
-      <property name="homogeneous">True</property>
-      <property name="spacing">6</property>
-
-      <child>
-	<object class="GtkButton" id="add_button">
-	  <property name="visible">True</property>
-	  <property name="tooltip-text" translatable="yes">Add...</property>
-	  <property name="can_focus">True</property>
-	  <property name="relief">GTK_RELIEF_NONE</property>
-	  <property name="focus_on_click">True</property>
-	  <signal name="clicked" handler="totem_playlist_add_files"/>
-
-	  <child>
-	    <object class="GtkAlignment" id="alignment1">
-	      <property name="visible">True</property>
-	      <property name="xalign">0.5</property>
-	      <property name="yalign">0.5</property>
-	      <property name="xscale">0</property>
-	      <property name="yscale">0</property>
-	      <property name="top_padding">0</property>
-	      <property name="bottom_padding">0</property>
-	      <property name="left_padding">0</property>
-	      <property name="right_padding">0</property>
-
-	      <child>
-		<object class="GtkHBox" id="hbox5">
-		  <property name="visible">True</property>
-		  <property name="homogeneous">False</property>
-		  <property name="spacing">2</property>
-
-		  <child>
-		    <object class="GtkImage" id="image1">
-		      <property name="visible">True</property>
-		      <property name="icon-name">list-add-symbolic</property>
-		      <property name="icon_size">4</property>
-		      <property name="xalign">0.5</property>
-		      <property name="yalign">0.5</property>
-		      <property name="xpad">0</property>
-		      <property name="ypad">0</property>
-		    </object>
-		    <packing>
-		      <property name="padding">0</property>
-		      <property name="expand">False</property>
-		      <property name="fill">False</property>
-		    </packing>
-		  </child>
-
-		  <!--Placeholder-->
-		</object>
-	      </child>
-	    </object>
-	  </child>
-	</object>
-	<packing>
-	  <property name="padding">0</property>
-	  <property name="expand">True</property>
-	  <property name="fill">True</property>
-	</packing>
-      </child>
-
-      <child>
-	<object class="GtkButton" id="remove_button">
-	  <property name="visible">True</property>
-	  <property name="sensitive">False</property>
-	  <property name="tooltip-text" translatable="yes">Remove</property>
-	  <property name="can_focus">True</property>
-	  <property name="relief">GTK_RELIEF_NONE</property>
-	  <property name="focus_on_click">True</property>
-	  <signal name="clicked" handler="playlist_remove_button_clicked"/>
-
-	  <child>
-	    <object class="GtkImage" id="image4">
-	      <property name="visible">True</property>
-	      <property name="icon-name">list-remove-symbolic</property>
-	      <property name="icon_size">4</property>
-	      <property name="xalign">0.5</property>
-	      <property name="yalign">0.5</property>
-	      <property name="xpad">0</property>
-	      <property name="ypad">0</property>
-	    </object>
-	  </child>
-	</object>
-	<packing>
-	  <property name="padding">0</property>
-	  <property name="expand">True</property>
-	  <property name="fill">True</property>
-	</packing>
-      </child>
-
-      <child>
-	<object class="GtkButton" id="save_button">
-	  <property name="visible">True</property>
-	  <property name="tooltip-text" translatable="yes">Save Playlist...</property>
-	  <property name="can_focus">True</property>
-	  <property name="relief">GTK_RELIEF_NONE</property>
-	  <property name="focus_on_click">True</property>
-	  <signal name="clicked" handler="totem_playlist_save_files"/>
-
-	  <child>
-	    <object class="GtkAlignment" id="alignment2">
-	      <property name="visible">True</property>
-	      <property name="xalign">0.5</property>
-	      <property name="yalign">0.5</property>
-	      <property name="xscale">0</property>
-	      <property name="yscale">0</property>
-	      <property name="top_padding">0</property>
-	      <property name="bottom_padding">0</property>
-	      <property name="left_padding">0</property>
-	      <property name="right_padding">0</property>
-
-	      <child>
-		<object class="GtkHBox" id="hbox6">
-		  <property name="visible">True</property>
-		  <property name="homogeneous">False</property>
-		  <property name="spacing">2</property>
-
-		  <child>
-		    <object class="GtkImage" id="image2">
-		      <property name="visible">True</property>
-		      <property name="icon-name">document-save-symbolic</property>
-		      <property name="icon_size">4</property>
-		      <property name="xalign">0.5</property>
-		      <property name="yalign">0.5</property>
-		      <property name="xpad">0</property>
-		      <property name="ypad">0</property>
-		    </object>
-		    <packing>
-		      <property name="padding">0</property>
-		      <property name="expand">False</property>
-		      <property name="fill">False</property>
-		    </packing>
-		  </child>
-
-		  <!--Placeholder-->
-		</object>
-	      </child>
-	    </object>
-	  </child>
-	</object>
-	<packing>
-	  <property name="padding">0</property>
-	  <property name="expand">True</property>
-	  <property name="fill">True</property>
-	</packing>
-      </child>
-
-      <child>
-	<object class="GtkButton" id="up_button">
-	  <property name="visible">True</property>
-	  <property name="sensitive">False</property>
-	  <property name="tooltip-text" translatable="yes">Move Up</property>
-	  <property name="can_focus">True</property>
-	  <property name="relief">GTK_RELIEF_NONE</property>
-	  <property name="focus_on_click">True</property>
-	  <signal name="clicked" handler="totem_playlist_up_files"/>
-
-	  <child>
-	    <object class="GtkImage" id="image5">
-	      <property name="visible">True</property>
-	      <property name="icon-name">go-up-symbolic</property>
-	      <property name="icon_size">4</property>
-	      <property name="xalign">0.5</property>
-	      <property name="yalign">0.5</property>
-	      <property name="xpad">0</property>
-	      <property name="ypad">0</property>
-	    </object>
-	  </child>
-	</object>
-	<packing>
-	  <property name="padding">0</property>
-	  <property name="expand">True</property>
-	  <property name="fill">True</property>
-	</packing>
-      </child>
-
-      <child>
-	<object class="GtkButton" id="down_button">
-	  <property name="visible">True</property>
-	  <property name="sensitive">False</property>
-	  <property name="tooltip-text" translatable="yes">Move Down</property>
-	  <property name="can_focus">True</property>
-	  <property name="relief">GTK_RELIEF_NONE</property>
-	  <property name="focus_on_click">True</property>
-	  <signal name="clicked" handler="totem_playlist_down_files"/>
-
-	  <child>
-	    <object class="GtkImage" id="image6">
-	      <property name="visible">True</property>
-	      <property name="icon-name">go-down-symbolic</property>
-	      <property name="icon_size">4</property>
-	      <property name="xalign">0.5</property>
-	      <property name="yalign">0.5</property>
-	      <property name="xpad">0</property>
-	      <property name="ypad">0</property>
-	    </object>
-	  </child>
-	</object>
-	<packing>
-	  <property name="padding">0</property>
-	  <property name="expand">True</property>
-	  <property name="fill">True</property>
-	</packing>
-      </child>
-    </object>
-    <packing>
-      <property name="padding">0</property>
-      <property name="expand">False</property>
-      <property name="fill">True</property>
-    </packing>
-  </child>
-</object>
-
+  <!-- interface-requires gtk+ 2.12 -->
+  <object class="GtkListStore" id="playlist_list_store">
+    <columns>
+      <!-- column-name gint -->
+      <column type="gint"/>
+      <!-- column-name gchararray -->
+      <column type="gchararray"/>
+      <!-- column-name gchararray1 -->
+      <column type="gchararray"/>
+      <!-- column-name gchararray2 -->
+      <column type="gchararray"/>
+      <!-- column-name gboolean -->
+      <column type="gboolean"/>
+      <!-- column-name gchararray3 -->
+      <column type="gchararray"/>
+      <!-- column-name gobject -->
+      <column type="GObject"/>
+    </columns>
+  </object>
+  <object class="GtkVBox" id="vbox4">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="spacing">0</property>
+    <child>
+      <object class="GtkScrolledWindow" id="scrolledwindow1">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="shadow_type">in</property>
+        <child>
+          <object class="GtkTreeView" id="treeview1">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="model">playlist_list_store</property>
+            <property name="headers_visible">False</property>
+            <property name="rules_hint">True</property>
+            <child internal-child="selection">
+              <object class="GtkTreeSelection" id="treeview-selection1"/>
+            </child>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">True</property>
+        <property name="fill">True</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkToolbar" id="toolbar1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="icon_size">1</property>
+        <child>
+          <object class="GtkToolButton" id="add_button">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="use_action_appearance">False</property>
+            <property name="use_underline">True</property>
+	    <property name="icon_name">list-add-symbolic</property>
+	    <signal name="clicked" handler="totem_playlist_add_files"/>
+	    <property name="tooltip-text" translatable="yes">Add...</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="homogeneous">True</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkToolButton" id="remove_button">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="use_action_appearance">False</property>
+            <property name="use_underline">True</property>
+	    <property name="icon_name">list-remove-symbolic</property>
+	    <signal name="clicked" handler="playlist_remove_button_clicked"/>
+	    <property name="tooltip-text" translatable="yes">Remove</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="homogeneous">True</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkToolButton" id="save_button">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="use_action_appearance">False</property>
+            <property name="use_underline">True</property>
+	    <property name="icon_name">document-save-symbolic</property>
+	    <property name="tooltip-text" translatable="yes">Save Playlist...</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="homogeneous">True</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkToolButton" id="up_button">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="use_action_appearance">False</property>
+            <property name="use_underline">True</property>
+	    <property name="icon_name">go-up-symbolic</property>
+	    <property name="tooltip-text" translatable="yes">Move Up</property>
+	    <signal name="clicked" handler="totem_playlist_up_files"/>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="homogeneous">True</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkToolButton" id="down_button">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="use_action_appearance">False</property>
+            <property name="use_underline">True</property>
+	    <property name="icon_name">go-down-symbolic</property>
+	    <property name="tooltip-text" translatable="yes">Move Down</property>
+	    <signal name="clicked" handler="totem_playlist_down_files"/>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="homogeneous">True</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">1</property>
+      </packing>
+    </child>
+  </object>
 </interface>
diff --git a/src/totem-playlist.c b/src/totem-playlist.c
index 3f06b15..7a23656 100644
--- a/src/totem-playlist.c
+++ b/src/totem-playlist.c
@@ -1655,6 +1655,8 @@ totem_playlist_init (TotemPlaylist *playlist)
 {
 	GtkWidget *container;
 	GtkBuilder *xml;
+	GtkWidget *widget;
+	GtkStyleContext *context;
 
 	playlist->priv = G_TYPE_INSTANCE_GET_PRIVATE (playlist, TOTEM_TYPE_PLAYLIST, TotemPlaylistPrivate);
 	playlist->priv->parser = totem_pl_parser_new ();
@@ -1692,6 +1694,14 @@ totem_playlist_init (TotemPlaylist *playlist)
 	playlist->priv->up_button = GTK_WIDGET (gtk_builder_get_object (xml, "up_button"));
 	playlist->priv->down_button = GTK_WIDGET (gtk_builder_get_object (xml, "down_button"));
 
+	/* Join treeview and buttons */
+	widget = GTK_WIDGET (gtk_builder_get_object (xml, ("scrolledwindow1")));
+	context = gtk_widget_get_style_context (widget);
+	gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM);
+	widget = GTK_WIDGET (gtk_builder_get_object (xml, ("toolbar1")));
+	context = gtk_widget_get_style_context (widget);
+	gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);
+
 	/* Reparent the vbox */
 	container = GTK_WIDGET (gtk_builder_get_object (xml, "vbox4"));
 	g_object_ref (container);



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