[Xfce4-commits] <parole:master> Started cleanup of menus, finished cleanup of disc menus.

Sean Davis noreply at xfce.org
Mon Jul 23 01:26:49 CEST 2012


Updating branch refs/heads/master
         to bf30152508a33fbffa7c232d10c89b2a75e0bb1b (commit)
       from f426c6c3ef995977bc45bc23a0c551b0c1a42b7a (commit)

commit bf30152508a33fbffa7c232d10c89b2a75e0bb1b
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Sun Jul 22 13:17:16 2012 -0400

    Started cleanup of menus, finished cleanup of disc menus.

 data/interfaces/parole.ui |  194 +++++++++++++++++++++++++++-----------------
 src/parole-disc.c         |   69 ++++++++--------
 2 files changed, 152 insertions(+), 111 deletions(-)

diff --git a/data/interfaces/parole.ui b/data/interfaces/parole.ui
index 91c21e6..9e9b8d9 100644
--- a/data/interfaces/parole.ui
+++ b/data/interfaces/parole.ui
@@ -79,6 +79,11 @@
     <property name="stock">gtk-fullscreen</property>
     <property name="icon-size">3</property>
   </object>
+  <object class="GtkImage" id="image22">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="icon_name">media-cdrom-audio</property>
+  </object>
   <object class="GtkImage" id="image3">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
@@ -189,70 +194,13 @@
                       </object>
                     </child>
                     <child>
-                      <object class="GtkImageMenuItem" id="dvd-menu">
-                        <property name="label" translatable="yes">_DVD</property>
+                      <object class="GtkImageMenuItem" id="menu-open-disc">
+                        <property name="label" translatable="yes">Play Disc</property>
                         <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="image">image14</property>
+                        <property name="image">image22</property>
                         <property name="use_stock">False</property>
-                        <child type="submenu">
-                          <object class="GtkMenu" id="menu6">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <child>
-                              <object class="GtkImageMenuItem" id="dvd-iso-mi">
-                                <property name="label" translatable="yes">From ISO image</property>
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="use_action_appearance">False</property>
-                                <property name="image">image15</property>
-                                <property name="use_stock">False</property>
-                                <signal name="activate" handler="dvd_iso_mi_activated_cb" swapped="no"/>
-                              </object>
-                            </child>
-                            <child>
-                              <object class="GtkSeparatorMenuItem" id="separatormenuitem5">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                              </object>
-                            </child>
-                          </object>
-                        </child>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkImageMenuItem" id="cd-menu">
-                        <property name="label">gtk-cdrom</property>
-                        <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="use_stock">True</property>
-                        <child type="submenu">
-                          <object class="GtkMenu" id="menu7">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <child>
-                              <object class="GtkImageMenuItem" id="cd-iso-mi">
-                                <property name="label" translatable="yes">From ISO image</property>
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="use_action_appearance">False</property>
-                                <property name="image">image16</property>
-                                <property name="use_stock">False</property>
-                                <signal name="activate" handler="cd_iso_mi_activated_cb" swapped="no"/>
-                              </object>
-                            </child>
-                            <child>
-                              <object class="GtkSeparatorMenuItem" id="separatormenuitem6">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                              </object>
-                            </child>
-                          </object>
-                        </child>
                       </object>
                     </child>
                     <child>
@@ -350,14 +298,21 @@
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <child>
-                      <object class="GtkCheckMenuItem" id="show-hide-list">
+                      <object class="GtkImageMenuItem" id="fullscreen-menu">
+                        <property name="label">gtk-fullscreen</property>
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="use_action_appearance">False</property>
-                        <property name="label" translatable="yes">Show _playlist</property>
                         <property name="use_underline">True</property>
-                        <accelerator key="F9" signal="activate"/>
-                        <signal name="activate" handler="parole_player_show_hide_playlist" swapped="no"/>
+                        <property name="use_stock">True</property>
+                        <accelerator key="F11" signal="activate"/>
+                        <signal name="activate" handler="parole_player_full_screen_activated_cb" swapped="no"/>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkSeparatorMenuItem" id="separatormenuitem3">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                       </object>
                     </child>
                     <child>
@@ -447,21 +402,78 @@
                       </object>
                     </child>
                     <child>
-                      <object class="GtkSeparatorMenuItem" id="separatormenuitem3">
+                      <object class="GtkSeparatorMenuItem" id="menuitem3">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
+                        <property name="use_action_appearance">False</property>
                       </object>
                     </child>
                     <child>
-                      <object class="GtkImageMenuItem" id="fullscreen-menu">
-                        <property name="label">gtk-fullscreen</property>
+                      <object class="GtkMenuItem" id="menuitem4">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="use_action_appearance">False</property>
+                        <property name="label" translatable="yes">Subtitles</property>
                         <property name="use_underline">True</property>
-                        <property name="use_stock">True</property>
-                        <accelerator key="F11" signal="activate"/>
-                        <signal name="activate" handler="parole_player_full_screen_activated_cb" swapped="no"/>
+                        <child type="submenu">
+                          <object class="GtkMenu" id="menu6">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="ubuntu_local">True</property>
+                            <child>
+                              <object class="GtkRadioMenuItem" id="menuitem6">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="label" translatable="yes">None</property>
+                                <property name="use_underline">True</property>
+                                <property name="draw_as_radio">True</property>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkSeparatorMenuItem" id="menuitem7">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="use_action_appearance">False</property>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkRadioMenuItem" id="menuitem8">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="label" translatable="yes">Select Text Subtitles...</property>
+                                <property name="use_underline">True</property>
+                                <property name="draw_as_radio">True</property>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkSeparatorMenuItem" id="menuitem9">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="use_action_appearance">False</property>
+                              </object>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkSeparatorMenuItem" id="menuitem5">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="use_action_appearance">False</property>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkCheckMenuItem" id="show-hide-list">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="label" translatable="yes">Show _playlist</property>
+                        <property name="use_underline">True</property>
+                        <accelerator key="F9" signal="activate"/>
+                        <signal name="activate" handler="parole_player_show_hide_playlist" swapped="no"/>
                       </object>
                     </child>
                   </object>
@@ -480,15 +492,35 @@
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <child>
-                      <object class="GtkImageMenuItem" id="volume-mute-menu">
-                        <property name="label" translatable="yes">_Mute</property>
+                      <object class="GtkMenuItem" id="menuitem10">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="use_action_appearance">False</property>
+                        <property name="label" translatable="yes">Languages</property>
                         <property name="use_underline">True</property>
-                        <property name="image">image12</property>
-                        <property name="use_stock">False</property>
-                        <signal name="activate" handler="parole_player_volume_mute" swapped="no"/>
+                        <child type="submenu">
+                          <object class="GtkMenu" id="menu7">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="ubuntu_local">True</property>
+                            <child>
+                              <object class="GtkMenuItem" id="menuitem11">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="use_action_appearance">False</property>
+                                <property name="label" translatable="yes">Empty</property>
+                                <property name="use_underline">True</property>
+                              </object>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkSeparatorMenuItem" id="menuitem12">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="use_action_appearance">False</property>
                       </object>
                     </child>
                     <child>
@@ -517,6 +549,18 @@
                         <signal name="activate" handler="parole_player_volume_down" swapped="no"/>
                       </object>
                     </child>
+                    <child>
+                      <object class="GtkImageMenuItem" id="volume-mute-menu">
+                        <property name="label" translatable="yes">_Mute</property>
+                        <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="image">image12</property>
+                        <property name="use_stock">False</property>
+                        <signal name="activate" handler="parole_player_volume_mute" swapped="no"/>
+                      </object>
+                    </child>
                   </object>
                 </child>
               </object>
diff --git a/src/parole-disc.c b/src/parole-disc.c
index 3aa8aee..4a660c5 100644
--- a/src/parole-disc.c
+++ b/src/parole-disc.c
@@ -54,8 +54,7 @@ struct ParoleDiscPrivate
     GVolumeMonitor *monitor;
     GPtrArray      *array;
     
-    GtkWidget      *dvd_menu;
-    GtkWidget	   *cd_menu;
+    GtkWidget      *disc_menu_item;
     
     gboolean	    needs_update;
 };
@@ -105,44 +104,36 @@ parole_disc_media_activate_cb (GtkWidget *widget, ParoleDisc *disc)
     g_signal_emit (G_OBJECT (disc), signals [DISC_SELECTED], 0, data->uri, data->device);
 }
 
-
 static void
-parole_disc_insert_menu_item (ParoleDisc *disc, MountData *data, const gchar *label)
+parole_disc_show_menu_item (ParoleDisc *disc, MountData *data, const gchar *label)
 {
-    GtkWidget *menu;
-    GtkWidget *img;
-    
-    data->mi = gtk_image_menu_item_new_with_label (label);
+	GtkWidget *img;
+	
+	switch (data->kind)
+	{
+		case PAROLE_DISC_CDDA:
+			img = gtk_image_new_from_icon_name("media-cdrom-audio", GTK_ICON_SIZE_MENU);
+			break;
+		case PAROLE_DISC_SVCD:
+		case PAROLE_DISC_VCD:
+		case PAROLE_DISC_DVD:
+			img = gtk_image_new_from_stock("gtk-cdrom", GTK_ICON_SIZE_MENU);
+			break;
+	}
 	
-    img = gtk_image_new_from_stock (GTK_STOCK_CDROM, GTK_ICON_SIZE_MENU);
-    gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (data->mi), 
-				   img);
-    gtk_widget_show (data->mi);
+	gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM (disc->priv->disc_menu_item), img);
+	gtk_menu_item_set_label( GTK_MENU_ITEM (disc->priv->disc_menu_item), label );
+
+	data->mi = disc->priv->disc_menu_item;
+	
+	gtk_widget_show (data->mi);
     gtk_widget_show (img);
 	
     g_object_set_data (G_OBJECT (data->mi),
 		      "mount-data", data);
-	
-    switch (data->kind )
-    {
-	case PAROLE_DISC_CDDA:
-	case PAROLE_DISC_SVCD:
-	case PAROLE_DISC_VCD:
-	    menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (disc->priv->cd_menu));
-	    break;
-	case PAROLE_DISC_DVD:
-	    menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (disc->priv->dvd_menu));
-	    break;
-	default:
-	    g_warn_if_reached ();
-	    break;
-    }
-    
-    gtk_menu_shell_insert (GTK_MENU_SHELL (menu), data->mi, 2);
-    
-    g_signal_connect (data->mi, "activate",
+		      
+	g_signal_connect (data->mi, "activate",
 		      G_CALLBACK (parole_disc_media_activate_cb), disc);
-    
 }
 
 static MountData *
@@ -227,7 +218,7 @@ got_cdda:
 	label = g_strdup_printf ("%s '%s'", _("Play Disc"), name);
 	
 	data = parole_disc_get_mount_data (disc, uri, device, kind);
-	parole_disc_insert_menu_item (disc, data, label);
+	parole_disc_show_menu_item (disc, data, label);
 	
 	if ( uri )
 	    g_free (uri);
@@ -271,7 +262,14 @@ parole_disc_check_cdrom (ParoleDisc *disc, GVolume *volume, const gchar *device)
 		{
 		    MountData *data;
 		    data = parole_disc_get_mount_data (disc, "cdda://", device, PAROLE_DISC_CDDA);
-		    parole_disc_insert_menu_item (disc, data, g_volume_get_name (volume));
+		    
+		    gchar *name;
+			gchar *label;
+	
+			name = g_volume_get_name (volume);
+			label = g_strdup_printf ("%s '%s'", _("Play Disc"), name);
+		    
+		    parole_disc_show_menu_item (disc, data, label);
 		    g_ptr_array_add (disc->priv->array, data);
 		}
 	    }
@@ -435,8 +433,7 @@ parole_disc_init (ParoleDisc *disc)
     g_signal_connect (G_OBJECT (disc->priv->monitor), "drive-eject-button",
 		      G_CALLBACK (parole_disc_monitor_changed_cb), disc);
     
-    disc->priv->dvd_menu = GTK_WIDGET (gtk_builder_get_object (builder, "dvd-menu"));
-    disc->priv->cd_menu = GTK_WIDGET (gtk_builder_get_object (builder, "cd-menu"));
+    disc->priv->disc_menu_item = GTK_WIDGET (gtk_builder_get_object (builder, "menu-open-disc"));
     
     g_signal_connect (gtk_builder_get_object (builder, "media-menu-item"), "select",
 	              G_CALLBACK (parole_disc_select_cb), disc);


More information about the Xfce4-commits mailing list