diff --git a/Makefile.am b/Makefile.am index 8be951b..15f4ee5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -9,7 +9,8 @@ AUTOMAKE_OPTIONS = dist-bzip2 uidir = $(datadir)/xfburn ui_DATA = \ - xfburn.ui \ + xfburn.ui \ + xfburn-popup-menus.ui \ xfburn-toolbars.ui # diff --git a/po/POTFILES.in b/po/POTFILES.in index a4eaa7f..14ce4c1 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -38,6 +38,7 @@ xfburn/xfburn-transcoder-gst.c xfburn/xfburn-transcoder.c xfburn/xfburn-device.c [type: gettext/glade]xfburn.ui +[type: gettext/glade]xfburn-popup-menus.ui desktop-integration/thunar-sendto-xfburn.desktop.in diff --git a/xfburn-popup-menus.ui b/xfburn-popup-menus.ui new file mode 100644 index 0000000..ec98030 --- /dev/null +++ b/xfburn-popup-menus.ui @@ -0,0 +1,45 @@ + + +
+ + win.create-dir + Create directory + +
+
+ + win.rename-file + Rename + + + win.remove-file + Remove + +
+
+ +
+ + win.remove-file + Remove + +
+ +
+ + win.rename-artist + Rename Artist + + + win.rename-title + Rename Title + +
+
+ + win.remove-file + Remove + +
+
+ diff --git a/xfburn/xfburn-audio-composition.c b/xfburn/xfburn-audio-composition.c index 23e3757..6be8f44 100644 --- a/xfburn/xfburn-audio-composition.c +++ b/xfburn/xfburn-audio-composition.c @@ -291,20 +291,7 @@ xfburn_audio_composition_init (XfburnAudioComposition * composition) GSimpleAction *action = NULL; GdkScreen *screen; GtkIconTheme *icon_theme; - -// TODO: This string should be exported as .ui file -// Otherwise the label text may not be included in the translations -#if 0 /* CDTEXT */ - const gchar ui_string[] = " " - "" "" "" ""; -#else - // const gchar ui_string[] = " " ""; - const gchar ui_string[] = "" - "
" - "Removewin.remove-file" - "
" - "
"; -#endif /* CDTEXT */ + gchar *popup_ui; GtkTargetEntry gte_src[] = { { "XFBURN_TREE_PATHS", GTK_TARGET_SAME_WIDGET, AUDIO_COMPOSITION_DND_TARGET_INSIDE } }; GtkTargetEntry gte_dest[] = { { "XFBURN_TREE_PATHS", GTK_TARGET_SAME_WIDGET, AUDIO_COMPOSITION_DND_TARGET_INSIDE }, @@ -324,6 +311,9 @@ xfburn_audio_composition_init (XfburnAudioComposition * composition) screen = gtk_widget_get_screen (GTK_WIDGET (composition)); icon_theme = gtk_icon_theme_get_for_screen (screen); + xfce_resource_push_path (XFCE_RESOURCE_DATA, DATADIR); + popup_ui = xfce_resource_lookup (XFCE_RESOURCE_DATA, "xfburn/xfburn-popup-menus.ui"); + gtk_icon_size_lookup (GTK_ICON_SIZE_SMALL_TOOLBAR, &x, &y); if (!icon_directory) icon_directory = gtk_icon_theme_load_icon (icon_theme, "folder", x, 0, NULL); @@ -336,7 +326,7 @@ xfburn_audio_composition_init (XfburnAudioComposition * composition) GTK_WIDGET (composition)); priv->ui_manager = gtk_builder_new (); gtk_builder_set_translation_domain (priv->ui_manager, GETTEXT_PACKAGE); - gtk_builder_add_from_string (priv->ui_manager, ui_string, -1, NULL); + gtk_builder_add_from_file(priv->ui_manager, popup_ui, NULL); gtk_widget_insert_action_group(GTK_WIDGET (composition), "win", G_ACTION_GROUP (priv->action_group)); hbox_toolbar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5); @@ -664,7 +654,11 @@ cb_treeview_button_pressed (GtkTreeView * treeview, GdkEventButton * event, Xfbu gtk_tree_path_free (path); } - model = G_MENU_MODEL (gtk_builder_get_object (priv->ui_manager, "popup-menu")); +#if 0 /* CDTEXT */ + model = G_MENU_MODEL (gtk_builder_get_object (priv->ui_manager, "audio-cdtext-popup-menu")); +#else + model = G_MENU_MODEL (gtk_builder_get_object (priv->ui_manager, "audio-popup-menu")); +#endif /* CDTEXT */ menu_popup = gtk_menu_new_from_model (model); gtk_widget_insert_action_group(GTK_WIDGET(menu_popup), "win", G_ACTION_GROUP (priv->action_group)); menuitem_remove = GTK_WIDGET (gtk_container_get_children (GTK_CONTAINER (menu_popup))->data); diff --git a/xfburn/xfburn-data-composition.c b/xfburn/xfburn-data-composition.c index ba4e25a..107862e 100644 --- a/xfburn/xfburn-data-composition.c +++ b/xfburn/xfburn-data-composition.c @@ -273,16 +273,6 @@ xfburn_data_composition_init (XfburnDataComposition * composition) GdkScreen *screen; GtkIconTheme *icon_theme; - // TODO: This string should be exported as .ui file - // Otherwise the label text may not be included in the translations - const gchar ui_string[] = "" - "
" - "win.create-dirCreate directory" - "
" - "win.rename-fileRename" - "win.remove-fileRemove" - "
"; - GtkTargetEntry gte_src[] = { { "XFBURN_TREE_PATHS", GTK_TARGET_SAME_WIDGET, DATA_COMPOSITION_DND_TARGET_INSIDE } }; GtkTargetEntry gte_dest[] = { { "XFBURN_TREE_PATHS", GTK_TARGET_SAME_WIDGET, DATA_COMPOSITION_DND_TARGET_INSIDE }, { "text/uri-list", 0, DATA_COMPOSITION_DND_TARGET_TEXT_URI_LIST }, @@ -310,8 +300,10 @@ xfburn_data_composition_init (XfburnDataComposition * composition) priv->ui_manager = gtk_builder_new (); gtk_builder_set_translation_domain(priv->ui_manager, GETTEXT_PACKAGE); - - gtk_builder_add_from_string (priv->ui_manager, ui_string, -1, NULL); + + xfce_resource_push_path (XFCE_RESOURCE_DATA, DATADIR); + gchar *popup_ui = xfce_resource_lookup (XFCE_RESOURCE_DATA, "xfburn/xfburn-popup-menus.ui"); + gtk_builder_add_from_file (priv->ui_manager, popup_ui, NULL); hbox_toolbar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5); gtk_box_pack_start (GTK_BOX (composition), hbox_toolbar, FALSE, TRUE, 0); @@ -592,10 +584,10 @@ cb_treeview_button_pressed (GtkTreeView * treeview, GdkEventButton * event, Xfbu gtk_tree_path_free (path); } - model = G_MENU_MODEL (gtk_builder_get_object (priv->ui_manager, "popup-menu")); + model = G_MENU_MODEL (gtk_builder_get_object (priv->ui_manager, "data-popup-menu")); menu_popup = gtk_menu_new_from_model (model); gtk_widget_insert_action_group(GTK_WIDGET(menu_popup), "win", G_ACTION_GROUP(priv->action_group)); - + GList *childs = gtk_container_get_children (GTK_CONTAINER (menu_popup)); menuitem_remove = GTK_WIDGET (childs->next->next->data); menuitem_rename = GTK_WIDGET (childs->next->data);