[Xfce4-commits] <xfce4-mpc-plugin:master> Add add_separator_and_label_with_markup() helper and use it in mpc_create()

Landry Breuil noreply at xfce.org
Sat May 15 00:18:01 CEST 2010


Updating branch refs/heads/master
         to 7e0dbc4b630506ee65e0428d4a64e0f67e6aa55b (commit)
       from 8f2a1057581138457e7a1d29ab279d7002c87b57 (commit)

commit 7e0dbc4b630506ee65e0428d4a64e0f67e6aa55b
Author: Landry Breuil <landry at xfce.org>
Date:   Fri May 14 18:00:35 2010 +0200

    Add add_separator_and_label_with_markup() helper and use it in mpc_create()
    
    Adds a GtkSeparatorMenuItem + a GtkMenuItem set as insensitive and using markup
    This commits adds two new strings for translators..

 panel-plugin/xfce4-mpc-plugin.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/panel-plugin/xfce4-mpc-plugin.c b/panel-plugin/xfce4-mpc-plugin.c
index 37f6f48..595b04e 100644
--- a/panel-plugin/xfce4-mpc-plugin.c
+++ b/panel-plugin/xfce4-mpc-plugin.c
@@ -687,6 +687,21 @@ new_button_with_cbk(XfcePanelPlugin * plugin, GtkWidget *parent, gpointer cb, gp
    return button;
 }
 
+static void
+add_separator_and_label_with_markup(XfcePanelPlugin* plugin, gchar* lbl)
+{
+   GtkWidget *separator, *menuitem, *label;
+   separator = gtk_separator_menu_item_new();
+   menuitem = gtk_menu_item_new_with_label(_(lbl));
+   gtk_widget_set_sensitive(menuitem, FALSE);
+   label = gtk_bin_get_child(GTK_BIN(menuitem));
+   gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
+   xfce_panel_plugin_menu_insert_item(plugin,GTK_MENU_ITEM(separator));
+   xfce_panel_plugin_menu_insert_item(plugin,GTK_MENU_ITEM(menuitem));
+   gtk_widget_show (separator);
+   gtk_widget_show (menuitem);
+}
+
 static t_mpc*
 mpc_create (XfcePanelPlugin * plugin)
 {
@@ -723,9 +738,12 @@ mpc_create (XfcePanelPlugin * plugin)
    g_signal_connect (G_OBJECT(mpc->repeat), "toggled", G_CALLBACK (mpc_repeat_toggled), mpc);
    mpc->appl = gtk_menu_item_new_with_label (_("Launch"));
    g_signal_connect (G_OBJECT(mpc->appl), "activate", G_CALLBACK (mpc_launch_client), mpc);
+
+   add_separator_and_label_with_markup(plugin, "<b><i>Commands</i></b>");
    xfce_panel_plugin_menu_insert_item(plugin,GTK_MENU_ITEM(mpc->random));
    xfce_panel_plugin_menu_insert_item(plugin,GTK_MENU_ITEM(mpc->repeat));
    xfce_panel_plugin_menu_insert_item(plugin,GTK_MENU_ITEM(mpc->appl));
+   add_separator_and_label_with_markup(plugin, "<b><i>Outputs</i></b>");
    gtk_widget_show (mpc->repeat);
    gtk_widget_show (mpc->random);
    gtk_widget_show (mpc->appl);



More information about the Xfce4-commits mailing list