gnome-bluetooth r501 - trunk/applet



Author: hadess
Date: Thu Mar 19 17:23:45 2009
New Revision: 501
URL: http://svn.gnome.org/viewvc/gnome-bluetooth?rev=501&view=rev

Log:
Boldify the label of connected devices

Gross Hacks Inc. present, how to boldify a
menu item label. Thanks for coming.



Modified:
   trunk/applet/main.c

Modified: trunk/applet/main.c
==============================================================================
--- trunk/applet/main.c	(original)
+++ trunk/applet/main.c	Thu Mar 19 17:23:45 2009
@@ -313,6 +313,19 @@
 }
 
 static void
+action_set_markup (GtkUIManager *manager, const char *name, const char *str)
+{
+	GtkWidget *widget;
+	char *path;
+
+	path = g_strdup_printf ("/bluetooth-applet-popup/devices-placeholder/%s", name);
+	widget = gtk_ui_manager_get_widget (manager, path);
+	g_free (path);
+	g_assert (widget);
+	gtk_label_set_markup (GTK_LABEL (GTK_BIN (widget)->child), str);
+}
+
+static void
 remove_action_item (GtkAction *action, gpointer data)
 {
 	gtk_action_group_remove_action (devices_action_group, action);
@@ -375,12 +388,10 @@
 		if (table != NULL && address != NULL) {
 			char *label;
 
-			/* FIXME we should have a bold label here instead
-			 * try with gtk_ui_manager_get_widget() */
 			if (connected != FALSE)
-				label = g_strdup_printf (_("%s (Connected)"), name);
+				label = g_strdup_printf ("<b>%s</b>", name);
 			else
-				label = g_strdup_printf (_("%s (Disconnected)"), name);
+				label = g_strdup_printf ("%s", name);
 
 			if (action == NULL) {
 				action = gtk_action_new (address, label, NULL, NULL);
@@ -393,6 +404,8 @@
 			} else {
 				gtk_action_set_label (action, label);
 			}
+			/* And now for the trick of the day */
+			action_set_markup (GTK_UI_MANAGER (object), address, label);
 			g_free (label);
 
 			num_devices++;



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