[Xfce4-commits] [apps/xfburn] 18/42: Added back the missing toolbars

noreply at xfce.org noreply at xfce.org
Tue Oct 15 02:22:01 CEST 2019


This is an automated email from the git hooks/post-receive script.

k   a   t   a   n   a   s   t   e   e   l       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfburn.

commit 9097a03cb2d4450461ec0476efdaf19650cffc90
Author: Rene Kjellerup <rk.katana.steel at gmail.com>
Date:   Thu Dec 6 17:46:15 2018 -0800

    Added back the missing toolbars
    
    and moved the add toolbar button function
    to utils, that it can be shared between
    main window, audio tab and data tab
---
 xfburn/xfburn-audio-composition.c | 22 ++++++++++++++++++++--
 xfburn/xfburn-data-composition.c  | 19 +++++++++++++++++--
 xfburn/xfburn-main-window.c       | 31 +++++--------------------------
 xfburn/xfburn-utils.c             | 20 ++++++++++++++++++++
 xfburn/xfburn-utils.h             |  2 ++
 5 files changed, 64 insertions(+), 30 deletions(-)

diff --git a/xfburn/xfburn-audio-composition.c b/xfburn/xfburn-audio-composition.c
index 9ad988e..738d363 100644
--- a/xfburn/xfburn-audio-composition.c
+++ b/xfburn/xfburn-audio-composition.c
@@ -388,9 +388,27 @@ xfburn_audio_composition_init (XfburnAudioComposition * composition)
 
   priv->toolbar = exo_toolbars_view_new_with_model (priv->ui_manager, model_toolbar);
 */
-  priv->toolbar = gtk_label_new ("placeholder for Gtk3Toolbar");
+  priv->toolbar = gtk_toolbar_new ();
+  gtk_toolbar_set_style(GTK_TOOLBAR (priv->toolbar), GTK_TOOLBAR_BOTH);
+  gtk_widget_insert_action_group (priv->toolbar, "win", G_ACTION_GROUP (priv->action_group));
+
+  xfburn_add_button_to_toolbar (GTK_TOOLBAR (priv->toolbar),
+    "list-add", "Add", "win.add-file", _("Add the selected file(s) to the composition"));
+
+  gtk_toolbar_insert (GTK_TOOLBAR (priv->toolbar), gtk_separator_tool_item_new(), -1);
+
+  xfburn_add_button_to_toolbar (GTK_TOOLBAR (priv->toolbar),
+    "list-remove", "Remove", "win.remove-file", _("Remove the selected file(s) to the composition"));
+  xfburn_add_button_to_toolbar (GTK_TOOLBAR (priv->toolbar),
+    "edit-clear", "Clear", "win.clear", _("Clear the content of the composition"));
+
+  gtk_toolbar_insert (GTK_TOOLBAR (priv->toolbar), gtk_separator_tool_item_new(), -1);
+
+  xfburn_add_button_to_toolbar (GTK_TOOLBAR (priv->toolbar),
+    "help-about", "gstreamer", "win.transcoder-info", _("What file can get burned to an audio CD"));
+
   gtk_box_pack_start (GTK_BOX (hbox_toolbar), priv->toolbar, TRUE, TRUE, 0);
-  gtk_widget_show (priv->toolbar);
+  gtk_widget_show_all (priv->toolbar);
 
     
   /* content treeview */
diff --git a/xfburn/xfburn-data-composition.c b/xfburn/xfburn-data-composition.c
index 5958e03..5f00ded 100644
--- a/xfburn/xfburn-data-composition.c
+++ b/xfburn/xfburn-data-composition.c
@@ -358,9 +358,24 @@ xfburn_data_composition_init (XfburnDataComposition * composition)
 
   priv->toolbar = exo_toolbars_view_new_with_model (priv->ui_manager, model_toolbar);
 */
-  priv->toolbar = gtk_label_new ("placeholder for Gtk3Toolbar");
+  priv->toolbar = gtk_toolbar_new ();
+  gtk_toolbar_set_style(GTK_TOOLBAR (priv->toolbar), GTK_TOOLBAR_BOTH);
+  gtk_widget_insert_action_group (priv->toolbar, "win", G_ACTION_GROUP (priv->action_group));
+
+  xfburn_add_button_to_toolbar (GTK_TOOLBAR (priv->toolbar),
+    "list-add", "Add", "win.add-file", _("Add the selected file(s) to the composition"));
+  xfburn_add_button_to_toolbar (GTK_TOOLBAR (priv->toolbar),
+    "folder-new", "Create directory", "win.create-dir", _("Add a new directory to the composition"));
+
+  gtk_toolbar_insert (GTK_TOOLBAR (priv->toolbar), gtk_separator_tool_item_new(), -1);
+
+  xfburn_add_button_to_toolbar (GTK_TOOLBAR (priv->toolbar),
+    "list-remove", "Remove", "win.remove-file", _("Remove the selected file(s) to the composition"));
+  xfburn_add_button_to_toolbar (GTK_TOOLBAR (priv->toolbar),
+    "edit-clear", "Clear", "win.clear", _("Clear the content of the composition"));
+
   gtk_box_pack_start (GTK_BOX (hbox_toolbar), priv->toolbar, TRUE, TRUE, 0);
-  gtk_widget_show (priv->toolbar);
+  gtk_widget_show_all (priv->toolbar);
     
   /* volume name */
   hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);
diff --git a/xfburn/xfburn-main-window.c b/xfburn/xfburn-main-window.c
index d0d861a..375496a 100644
--- a/xfburn/xfburn-main-window.c
+++ b/xfburn/xfburn-main-window.c
@@ -242,26 +242,6 @@ xfburn_main_window_finalize (GObject *obj)
 }
 
 static void
-add_button_to_toolbar(GtkToolbar *toolbar, const gchar *stock, const gchar *text, const gchar *action, const gchar *tooltip)
-{
-  GtkToolItem *item;
-  GtkWidget *icon;
-  GtkWidget *label;
-
-  gchar *markup = g_markup_printf_escaped("<span size=\"small\" weight=\"bold\">%s</span>", text);
-  label = gtk_label_new(NULL);
-  gtk_label_set_markup(GTK_LABEL (label), markup);
-  g_free(markup);
-
-  icon = gtk_image_new_from_icon_name (stock, 0);
-  item = gtk_tool_button_new(icon, text);
-  gtk_tool_item_set_tooltip_text(item, (tooltip == NULL) ? text : tooltip);
-  gtk_tool_button_set_label_widget(GTK_TOOL_BUTTON (item), label);
-  gtk_toolbar_insert(toolbar, item, -1);
-  gtk_actionable_set_action_name (GTK_ACTIONABLE (item), action);
-}
-
-static void
 xfburn_main_window_init (XfburnMainWindow * mainwin)
 {
   XfburnMainWindowPrivate *priv = XFBURN_MAIN_WINDOW_GET_PRIVATE (mainwin);
@@ -351,27 +331,26 @@ xfburn_main_window_init (XfburnMainWindow * mainwin)
   }
 */
   priv->toolbars = gtk_toolbar_new ();
-//  gtk_orientable_set_orientation (priv->toolbars, GTK_ORIENTATION_HORIZONTAL);
   gtk_toolbar_set_style(GTK_TOOLBAR (priv->toolbars), GTK_TOOLBAR_BOTH);
   gtk_widget_insert_action_group (priv->toolbars, "app", G_ACTION_GROUP (priv->action_map));
 
-  add_button_to_toolbar (GTK_TOOLBAR (priv->toolbars),
+  xfburn_add_button_to_toolbar (GTK_TOOLBAR (priv->toolbars),
     "stock_xfburn-new-data-composition", "New data composition", "app.new-data-composition", NULL);
 
-  add_button_to_toolbar (GTK_TOOLBAR (priv->toolbars),
+  xfburn_add_button_to_toolbar (GTK_TOOLBAR (priv->toolbars),
     "stock_xfburn-audio-cd", "New audio composition", "app.new-audio-composition", NULL);
 
   gtk_toolbar_insert (GTK_TOOLBAR (priv->toolbars), gtk_separator_tool_item_new(), -1);
 
-  add_button_to_toolbar (GTK_TOOLBAR (priv->toolbars), 
+  xfburn_add_button_to_toolbar (GTK_TOOLBAR (priv->toolbars), 
     "stock_xfburn-blank-cdrw", "Blank CD-RW", "app.blank-disc", NULL);
   
-  add_button_to_toolbar (GTK_TOOLBAR (priv->toolbars),
+  xfburn_add_button_to_toolbar (GTK_TOOLBAR (priv->toolbars),
     "stock_xfburn", "Burn Image", "app.burn-image", NULL);
 
   gtk_toolbar_insert (GTK_TOOLBAR (priv->toolbars), gtk_separator_tool_item_new(), -1);
 
-  add_button_to_toolbar (GTK_TOOLBAR (priv->toolbars),
+  xfburn_add_button_to_toolbar (GTK_TOOLBAR (priv->toolbars),
     "view-refresh", "Refresh", "app.refresh", "Refresh file list");
 
   gtk_box_pack_start (GTK_BOX (vbox), priv->toolbars, FALSE, FALSE, 5);
diff --git a/xfburn/xfburn-utils.c b/xfburn/xfburn-utils.c
index 71522a6..f613cb9 100644
--- a/xfburn/xfburn-utils.c
+++ b/xfburn/xfburn-utils.c
@@ -281,3 +281,23 @@ xfburn_make_abosulet_file_list (gint count, gchar *filenames[])
 
   return list;
 }
+/* adding items to a toolbar*/
+void
+xfburn_add_button_to_toolbar(GtkToolbar *toolbar, const gchar *stock, const gchar *text, const gchar *action, const gchar *tooltip)
+{
+  GtkToolItem *item;
+  GtkWidget *icon;
+  GtkWidget *label;
+
+  gchar *markup = g_markup_printf_escaped("<span size=\"small\" weight=\"bold\">%s</span>", text);
+  label = gtk_label_new(NULL);
+  gtk_label_set_markup(GTK_LABEL (label), markup);
+  g_free(markup);
+
+  icon = gtk_image_new_from_icon_name (stock, 0);
+  item = gtk_tool_button_new(icon, text);
+  gtk_tool_item_set_tooltip_text(item, (tooltip == NULL) ? text : tooltip);
+  gtk_tool_button_set_label_widget(GTK_TOOL_BUTTON (item), label);
+  gtk_toolbar_insert(toolbar, item, -1);
+  gtk_actionable_set_action_name (GTK_ACTIONABLE (item), action);
+}
diff --git a/xfburn/xfburn-utils.h b/xfburn/xfburn-utils.h
index 3eeff45..83845f2 100644
--- a/xfburn/xfburn-utils.h
+++ b/xfburn/xfburn-utils.h
@@ -48,4 +48,6 @@ void xfburn_capture_libburn_messages (void);
 void xfburn_console_libburn_messages (void);
 int xfburn_media_profile_to_kb (int media_no);
 
+void xfburn_add_button_to_toolbar(GtkToolbar *toolbar, const gchar *stock, const gchar *text, const gchar *action, const gchar *tooltip);
+
 #endif

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list