rhythmbox r6112 - in trunk: . bindings/python doc/reference plugins/cd-recorder shell widgets widgets/libsexy



Author: jmatthew
Date: Sun Dec 21 11:39:47 2008
New Revision: 6112
URL: http://svn.gnome.org/viewvc/rhythmbox?rev=6112&view=rev

Log:
2008-12-21  Jonathan Matthew  <jonathan d14n org>

	* shell/rb-tray-icon.c: (rb_tray_icon_init),
	(rb_tray_icon_finalize), (rb_tray_icon_update_tooltip_visibility),
	(rb_tray_icon_set_tooltip_primary_text),
	(rb_tray_icon_set_tooltip_icon),
	(rb_tray_icon_set_tooltip_secondary_markup), (rb_tray_icon_notify),
	(tray_icon_tooltip_cb), (rb_tray_icon_create_blank_image):
	* shell/rb-tray-icon.h:
	Use a normal GtkTooltip, containing an image and some markup, rather
	than a custom arrangement of widgets in a SexyTooltip.  Probably looks
	a bit better and also might be accessible now.  To work with the
	GtkTooltip API, use a GdkPixbuf instead of a GtkImage.

	* shell/rb-shell.c: (rb_shell_db_metadata_art_cb),
	(rb_shell_hidden_notify), (rb_shell_hidden_notify_markup):
	* shell/rb-shell.h:
	* plugins/cd-recorder/rb-playlist-source-recorder.c: (burn_cd),
	(rb_playlist_source_recorder_constructor):
	* bindings/python/rb.defs:
	RBTrayIcon now wants a GdkPixbuf instead of a GtkImage.
	
	* widgets/eggtrayicon.c: (egg_tray_icon_notify):
	* widgets/eggtrayicon.h:
	RBTrayIcon now provides a GdkPixbuf instead of a GtkImage, which is
	OK because that's what libnotify wants.

	* doc/reference/Makefile.am:
	* widgets/libsexy/Makefile.am:
	* widgets/libsexy/sexy-tooltip.c:
	* widgets/libsexy/sexy-tooltip.h:
	Remove our copy of SexyTooltip.


Removed:
   trunk/widgets/libsexy/sexy-tooltip.c
   trunk/widgets/libsexy/sexy-tooltip.h
Modified:
   trunk/ChangeLog
   trunk/bindings/python/rb.defs
   trunk/doc/reference/Makefile.am
   trunk/plugins/cd-recorder/rb-playlist-source-recorder.c
   trunk/shell/rb-shell.c
   trunk/shell/rb-shell.h
   trunk/shell/rb-tray-icon.c
   trunk/shell/rb-tray-icon.h
   trunk/widgets/eggtrayicon.c
   trunk/widgets/eggtrayicon.h
   trunk/widgets/libsexy/Makefile.am

Modified: trunk/bindings/python/rb.defs
==============================================================================
--- trunk/bindings/python/rb.defs	(original)
+++ trunk/bindings/python/rb.defs	Sun Dec 21 11:39:47 2008
@@ -403,7 +403,7 @@
   (parameters
     '("guint" "timeout")
     '("const-char*" "primary")
-    '("GtkWidget*" "icon")
+    '("GdkPixbuf*" "pixbuf")
     '("const-char*" "secondary")
     '("gboolean" "requested")
   )

Modified: trunk/doc/reference/Makefile.am
==============================================================================
--- trunk/doc/reference/Makefile.am	(original)
+++ trunk/doc/reference/Makefile.am	Sun Dec 21 11:39:47 2008
@@ -36,7 +36,6 @@
 	rb-cut-and-paste-code.h \
 	rb-marshal.h \
 	rhythmdb-private.h \
-	sexy-tooltip.h \
 	sexy-icon-entry.h \
 	\
 	rb-shell-glue.h \

Modified: trunk/plugins/cd-recorder/rb-playlist-source-recorder.c
==============================================================================
--- trunk/plugins/cd-recorder/rb-playlist-source-recorder.c	(original)
+++ trunk/plugins/cd-recorder/rb-playlist-source-recorder.c	Sun Dec 21 11:39:47 2008
@@ -116,7 +116,7 @@
         GTimer      *timer;
         guint64      start_pos;
 
-        GtkWidget   *cd_icon;
+        GdkPixbuf   *cd_icon;
         GtkWidget   *vbox;
         GtkWidget   *multiple_copies_checkbutton;
         GtkWidget   *cancel_button;
@@ -553,6 +553,12 @@
 
                 finished_msg = _("Finished creating audio CD.");
 
+		if (source->priv->cd_icon == NULL) {
+			source->priv->cd_icon = gtk_widget_render_icon (GTK_WIDGET (source),
+									GTK_STOCK_CDROM,
+									GTK_ICON_SIZE_BUTTON,
+									NULL);
+		}
                 rb_shell_hidden_notify (source->priv->shell, 0, finished_msg, source->priv->cd_icon, "", FALSE);
 
                 /* save the write speed that was used */
@@ -1157,9 +1163,7 @@
         hbox = gtk_hbox_new (FALSE, 6);
         gtk_container_add (GTK_CONTAINER (widget), hbox);
         gtk_widget_show (hbox);
-        widget = gtk_image_new_from_stock (GTK_STOCK_CDROM, GTK_ICON_SIZE_BUTTON);
-        source->priv->cd_icon = widget;
-        g_object_ref (source->priv->cd_icon);
+
         gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
         gtk_widget_show (widget);
         widget = gtk_label_new_with_mnemonic (_("C_reate"));

Modified: trunk/shell/rb-shell.c
==============================================================================
--- trunk/shell/rb-shell.c	(original)
+++ trunk/shell/rb-shell.c	Sun Dec 21 11:39:47 2008
@@ -377,7 +377,7 @@
 	/* markup, used for notifications and for tray tooltips */
 	char *cached_notify_primary;
 	char *cached_notify_secondary;
-	GtkWidget *cached_art_icon;
+	GdkPixbuf *cached_art_icon;
 
 	guint sidepane_visibility_notify_id;
 	guint toolbar_visibility_notify_id;
@@ -1749,8 +1749,6 @@
 			     GValue *metadata,
 			     RBShell *shell)
 {
-	GdkPixbuf *pixbuf = NULL;
-	GdkPixbuf *my_pixbuf;
 	RhythmDBEntry *playing_entry;
 	guint time;
 
@@ -1769,11 +1767,11 @@
 	}
 
 	if (G_VALUE_HOLDS (metadata, GDK_TYPE_PIXBUF)) {
+		GdkPixbuf *pixbuf;
+
 		pixbuf = GDK_PIXBUF (g_value_get_object (metadata));
 		if (pixbuf != NULL) {
-			my_pixbuf = rb_scale_pixbuf_to_size (pixbuf, GTK_ICON_SIZE_DIALOG);
-			shell->priv->cached_art_icon = g_object_ref_sink (gtk_image_new_from_pixbuf (my_pixbuf));
-			g_object_unref (my_pixbuf);
+			shell->priv->cached_art_icon = rb_scale_pixbuf_to_size (pixbuf, GTK_ICON_SIZE_DIALOG);
 		}
 	}
 
@@ -3070,7 +3068,7 @@
 rb_shell_hidden_notify (RBShell *shell,
 			guint timeout,
 			const char *primary,
-			GtkWidget *icon,
+			GdkPixbuf *pixbuf,
 			const char *secondary,
 			gboolean requested)
 {
@@ -3078,7 +3076,7 @@
 	char *secondary_markup = g_markup_escape_text (secondary, -1);
 
 	rb_shell_hidden_notify_markup (shell, timeout, primary_markup, 
-				       icon, secondary_markup, requested);
+				       pixbuf, secondary_markup, requested);
 
 	g_free (primary_markup);
 	g_free (secondary_markup);
@@ -3088,7 +3086,7 @@
 rb_shell_hidden_notify_markup (RBShell *shell,
 			       guint timeout,
 			       const char *primary_markup,
-			       GtkWidget *icon,
+			       GdkPixbuf *pixbuf,
 			       const char *secondary_markup,
 			       gboolean requested)
 {
@@ -3101,7 +3099,7 @@
 	rb_tray_icon_notify (shell->priv->tray_icon,
 			     timeout,
 			     primary_markup,
-			     icon,
+			     pixbuf,
 			     secondary_markup,
 			     requested);
 }

Modified: trunk/shell/rb-shell.h
==============================================================================
--- trunk/shell/rb-shell.h	(original)
+++ trunk/shell/rb-shell.h	Sun Dec 21 11:39:47 2008
@@ -143,13 +143,13 @@
 void            rb_shell_hidden_notify  (RBShell *shell,
 					 guint timeout,
 					 const char *primary,
-					 GtkWidget *icon,
+					 GdkPixbuf *pixbuf,
 					 const char *secondary,
 					 gboolean requested);
 void            rb_shell_hidden_notify_markup  (RBShell *shell,
 						guint timeout,
 						const char *primary_markup,
-						GtkWidget *icon,
+						GdkPixbuf *pixbuf,
 						const char *secondary_markup,
 						gboolean requested);
 void		rb_shell_notify_playing_entry (RBShell *shell,

Modified: trunk/shell/rb-tray-icon.c
==============================================================================
--- trunk/shell/rb-tray-icon.c	(original)
+++ trunk/shell/rb-tray-icon.c	Sun Dec 21 11:39:47 2008
@@ -36,7 +36,6 @@
 
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
-#include <libsexy/sexy-tooltip.h>
 
 #include "rb-tray-icon.h"
 #include "rb-stock-icons.h"
@@ -49,8 +48,6 @@
 
 #define TRAY_ICON_DEFAULT_TOOLTIP _("Music Player")
 #define DEFAULT_TOOLTIP_ICON "" /*"gnome-media-player"*/
-#define TOOLTIPS_DELAY 500
-#define TOOLTIPS_STICKY_REVERT_DELAY 1000
 
 /**
  * SECTION:rb-tray-icon
@@ -99,12 +96,6 @@
 						RBTrayIcon *icon);
 static void rb_tray_icon_scroll_event_cb (GtkWidget *ebox, GdkEvent *event,
 						RBTrayIcon *icon);
-static void rb_tray_icon_enter_notify_event_cb (RBTrayIcon *icon,
-						GdkEvent *event,
-						GtkWidget *widget);
-static void rb_tray_icon_leave_notify_event_cb (RBTrayIcon *icon,
-						GdkEvent *event,
-						GtkWidget *widget);
 static void rb_tray_icon_show_window_changed_cb (GtkAction *action,
 						 RBTrayIcon *icon);
 static void rb_tray_icon_show_notifications_changed_cb (GtkAction *action,
@@ -118,8 +109,13 @@
 				  guint time,
 				  RBTrayIcon *icon);
 static void rb_tray_icon_suppress_tooltips (RBTrayIcon *icon, guint duration);
-static void rb_tray_icon_construct_tooltip (RBTrayIcon *icon);
-static GtkWidget* rb_tray_icon_create_blank_image (RBTrayIcon *icon);
+static GdkPixbuf* rb_tray_icon_create_blank_image (RBTrayIcon *icon);
+static gboolean tray_icon_tooltip_cb (GtkWidget  *widget,
+				      gint        x,
+				      gint        y,
+				      gboolean    keyboard_tooltip,
+				      GtkTooltip *tooltip,
+				      RBTrayIcon *icon);
 
 struct RBTrayIconPrivate
 {
@@ -130,16 +126,12 @@
 	GtkWidget *not_playing_image;
 	GtkWidget *ebox;
 
-	GtkWidget *tooltip;
-	gboolean tooltips_pointer_above;
-	gboolean tooltips_sticky;
-	guint tooltip_sticky_id;
+	char *primary_text;
+	char *secondary_markup;
+	GdkPixbuf *pixbuf;
+
 	gboolean tooltips_suppressed;
-	GtkWidget *tooltip_primary;
-	GtkWidget *tooltip_secondary;
-	GtkWidget *tooltip_image_box;
 	guint tooltip_unsuppress_id;
-	guint tooltip_unhide_id;
 
 	RBShell *shell;
 	RBShellPlayer *shell_player;
@@ -236,7 +228,10 @@
 
 	icon->priv = RB_TRAY_ICON_GET_PRIVATE (icon);
 
-	rb_tray_icon_construct_tooltip (icon);
+	g_object_set (icon, "has-tooltip", TRUE, NULL);
+	g_signal_connect_object (icon, "query-tooltip",
+				 G_CALLBACK (tray_icon_tooltip_cb),
+				 icon, 0);
 
 	icon->priv->ebox = gtk_event_box_new ();
 	g_signal_connect_object (G_OBJECT (icon->priv->ebox),
@@ -247,14 +242,7 @@
 				 "scroll_event",
 				 G_CALLBACK (rb_tray_icon_scroll_event_cb),
 				 icon, 0);
-	g_signal_connect_object (G_OBJECT (icon->priv->ebox),
-				 "enter-notify-event",
-				 G_CALLBACK (rb_tray_icon_enter_notify_event_cb),
-				 icon, G_CONNECT_SWAPPED);
-	g_signal_connect_object (G_OBJECT (icon->priv->ebox),
-				 "leave-notify-event",
-				 G_CALLBACK (rb_tray_icon_leave_notify_event_cb),
-				 icon, G_CONNECT_SWAPPED);
+
 	gtk_drag_dest_set (icon->priv->ebox, GTK_DEST_DEFAULT_ALL, target_uri, 1, GDK_ACTION_COPY);
 	g_signal_connect_object (G_OBJECT (icon->priv->ebox), "drag_data_received",
 				 G_CALLBACK (rb_tray_icon_drop_cb), icon, 0);
@@ -358,9 +346,6 @@
 
 	if (tray->priv->tooltip_unsuppress_id > 0)
 		g_source_remove (tray->priv->tooltip_unsuppress_id);
-	if (tray->priv->tooltip_unhide_id > 0)
-		g_source_remove (tray->priv->tooltip_unhide_id);
-	gtk_object_destroy (GTK_OBJECT (tray->priv->tooltip));
 
 	G_OBJECT_CLASS (rb_tray_icon_parent_class)->finalize (object);
 }
@@ -649,100 +634,51 @@
 	*height = widget->allocation.y;
 }
 
-/* FIXME HORRIBLE HACK pending resolution of bug 350107 */
-#define sexy_tooltip_position_to_widget _rb_tooltip_position_to_widget
-static void
-sexy_tooltip_position_to_widget(SexyTooltip *tooltip, GtkWidget *widget)
-{
-	GdkScreen *screen;
-	gint x, y;
-	GdkRectangle rect;
-
-	screen = gtk_widget_get_screen(widget);
-	gdk_window_get_origin(widget->window, &x, &y);
-
-	rect.x = widget->allocation.x + x;
-	rect.y = widget->allocation.y + y;
-	rect.width  = widget->allocation.width;
-	rect.height = widget->allocation.height;
-
-	sexy_tooltip_position_to_rect(tooltip, &rect, screen);
-}
-/* END HACK */
-
 static void
 rb_tray_icon_update_tooltip_visibility (RBTrayIcon *icon)
 {
-	if (icon->priv->tooltips_pointer_above && icon->priv->tooltips_sticky
-			&& !icon->priv->tooltips_suppressed) {
-		sexy_tooltip_position_to_widget (SEXY_TOOLTIP (icon->priv->tooltip),
-						 icon->priv->ebox);
-		gtk_widget_show (icon->priv->tooltip);
-	} else
-		gtk_widget_hide (icon->priv->tooltip);
-}
-
-static gboolean
-rb_tray_icon_unhide_cb (RBTrayIcon *icon)
-{
-	gdk_threads_enter ();
-	rb_tray_icon_update_tooltip_visibility (icon);
-	icon->priv->tooltip_unhide_id = 0;
-	gdk_threads_leave ();
-	return FALSE;
+	gtk_widget_trigger_tooltip_query (GTK_WIDGET (icon));
 }
 
 /**
  * rb_tray_icon_set_tooltip_primary_text:
  * @icon: the #RBTrayIcon
- * @primary_text: New primary text for the tooltip
+ * @primary_text: the new primary text
  *
- * Updates the tooltip's primary text and updates the tooltip's
- * visibility.  The primary text cannot contain markup.  It is
- * always displayed in bold large type.
+ * Updates the primary (large) text in the tray icon.
  */
 void
 rb_tray_icon_set_tooltip_primary_text (RBTrayIcon *icon,
 				       const char *primary_text)
 {
-	/* hide, then reshow in the right position & size */
-	gtk_widget_hide (icon->priv->tooltip);
+	g_free (icon->priv->primary_text);
+	icon->priv->primary_text = g_strdup (primary_text);
 
-	if (primary_text == NULL)
-		primary_text = TRAY_ICON_DEFAULT_TOOLTIP;
-	gtk_label_set_text (GTK_LABEL (icon->priv->tooltip_primary),
-			    primary_text);
-
-	if (icon->priv->tooltip_unhide_id > 0)
-		g_source_remove (icon->priv->tooltip_unhide_id);
-	icon->priv->tooltip_unhide_id = g_idle_add ((GSourceFunc) rb_tray_icon_unhide_cb, icon);
+	gtk_widget_trigger_tooltip_query (GTK_WIDGET (icon));
 }
 
+
+
 /**
  * rb_tray_icon_set_tooltip_icon:
  * @icon: the #RBTrayIcon
- * @msgicon: a #GtkWidget to display as the icon in the tooltip
+ * @pixbuf: a #GdkPixbuf to display as the icon in the tooltip
  *
  * Updates the icon in the tooltip.
  */
 void
-rb_tray_icon_set_tooltip_icon (RBTrayIcon *icon, GtkWidget *msgicon)
+rb_tray_icon_set_tooltip_icon (RBTrayIcon *icon, GdkPixbuf *pixbuf)
 {
-	GtkContainer *image_box;
-	GtkWidget *current_image;
-	GList *children;
-
-	if (msgicon == NULL)
-		msgicon = rb_tray_icon_create_blank_image (icon);
-	image_box = GTK_CONTAINER (icon->priv->tooltip_image_box);
-	children = gtk_container_get_children (image_box);
-	current_image = GTK_WIDGET (g_list_nth_data (children, 0));
-	g_list_free (children);
-	if (current_image != msgicon) {
-		gtk_container_remove (image_box, current_image);
-		gtk_box_pack_start (GTK_BOX (image_box), msgicon, FALSE, FALSE, 0);
-		gtk_widget_show (msgicon);
+	if (icon->priv->pixbuf != NULL) {
+		g_object_unref (icon->priv->pixbuf);
+	}
+	if (pixbuf != NULL) {
+		icon->priv->pixbuf = g_object_ref (pixbuf);
+	} else {
+		icon->priv->pixbuf = rb_tray_icon_create_blank_image (icon);
 	}
+
+	gtk_widget_trigger_tooltip_query (GTK_WIDGET (icon));
 }
 
 /**
@@ -757,13 +693,10 @@
 rb_tray_icon_set_tooltip_secondary_markup (RBTrayIcon *icon,
 					   const char *secondary_markup)
 {
-	if (secondary_markup != NULL) {
-		gtk_label_set_markup (GTK_LABEL (icon->priv->tooltip_secondary),
-				      secondary_markup);
-		gtk_widget_show (icon->priv->tooltip_secondary);
-	} else {
-		gtk_widget_hide (icon->priv->tooltip_secondary);
-	}
+	g_free (icon->priv->secondary_markup);
+	icon->priv->secondary_markup = g_strdup (secondary_markup);
+
+	gtk_widget_trigger_tooltip_query (GTK_WIDGET (icon));
 }
 
 /**
@@ -771,7 +704,7 @@
  * @icon: the #RBTrayIcon
  * @timeout: how long the notification should be displayed (in milliseconds)
  * @primary_markup: primary markup to display in the notification
- * @msgicon: #GtkWidget to display as the image in the notification
+ * @pixbuf: #GdkPixbuf to display as the image in the notification
  * @secondary_markup: secondary markup to display in the notification
  * @requested: if %TRUE, the notification was directly requested by the user
  *
@@ -783,7 +716,7 @@
 rb_tray_icon_notify (RBTrayIcon *icon,
 		     guint timeout,
 		     const char *primary_markup,
-		     GtkWidget *msgicon,
+		     GdkPixbuf *pixbuf,
 		     const char *secondary_markup,
 		     gboolean requested)
 {
@@ -799,10 +732,10 @@
 	rb_debug ("doing notify: %s", primary_markup);
 	if (timeout > 0)
 		rb_tray_icon_suppress_tooltips (icon, timeout);
-	if (msgicon == NULL)
-		msgicon = rb_tray_icon_create_blank_image (icon);
+	if (pixbuf == NULL)
+		pixbuf = rb_tray_icon_create_blank_image (icon);
 	egg_tray_icon_notify (EGG_TRAY_ICON (icon), timeout,
-			      primary_markup, msgicon, secondary_markup);
+			      primary_markup, pixbuf, secondary_markup);
 }
 
 /**
@@ -818,116 +751,41 @@
 }
 
 static gboolean
-rb_tray_icon_sticky_cb (RBTrayIcon *icon)
+tray_icon_tooltip_cb (GtkWidget  *widget,
+		      gint        x,
+		      gint        y,
+		      gboolean    keyboard_tooltip,
+		      GtkTooltip *tooltip,
+		      RBTrayIcon *icon)
 {
-	gdk_threads_enter ();
-	icon->priv->tooltips_sticky = icon->priv->tooltips_pointer_above;
-	rb_tray_icon_update_tooltip_visibility (icon);
-	icon->priv->tooltip_sticky_id = 0;
-	gdk_threads_leave ();
-	return FALSE;
-}
+	char *esc_primary;
+	char *markup;
 
-static void
-rb_tray_icon_enter_notify_event_cb (RBTrayIcon *icon,
-				    GdkEvent *event,
-				    GtkWidget *widget)
-{
-	icon->priv->tooltips_pointer_above = TRUE;
-	rb_tray_icon_update_tooltip_visibility (icon);
-	if (icon->priv->tooltip_sticky_id > 0) {
-		g_source_remove (icon->priv->tooltip_sticky_id);
-		icon->priv->tooltip_sticky_id = 0;
-	}
+	if (icon->priv->tooltips_suppressed)
+		return FALSE;
 
-	if (!icon->priv->tooltips_sticky)
-		icon->priv->tooltip_sticky_id = g_timeout_add (TOOLTIPS_DELAY,
-							       (GSourceFunc) rb_tray_icon_sticky_cb,
-							       icon);
-}
+	gtk_tooltip_set_icon (tooltip, icon->priv->pixbuf);
 
-static void
-rb_tray_icon_leave_notify_event_cb (RBTrayIcon *icon,
-				    GdkEvent *event,
-				    GtkWidget *widget)
-{
-	icon->priv->tooltips_pointer_above = FALSE;
-	rb_tray_icon_update_tooltip_visibility (icon);
-	if (icon->priv->tooltip_sticky_id > 0) {
-		g_source_remove (icon->priv->tooltip_sticky_id);
-		icon->priv->tooltip_sticky_id = 0;
+	if (icon->priv->primary_text != NULL) {
+		esc_primary = g_markup_escape_text (icon->priv->primary_text, -1);
+	} else {
+		esc_primary = g_markup_escape_text (TRAY_ICON_DEFAULT_TOOLTIP, -1);
 	}
 
-	if (icon->priv->tooltips_sticky)
-		icon->priv->tooltip_sticky_id = g_timeout_add (TOOLTIPS_STICKY_REVERT_DELAY,
-							       (GSourceFunc) rb_tray_icon_sticky_cb,
-							       icon);
-}
-
-static void
-rb_tray_icon_tooltip_size_allocate_cb (RBTrayIcon *icon,
-				       GtkAllocation *allocation,
-				       GtkWidget *tooltip)
-{
-	sexy_tooltip_position_to_widget (SEXY_TOOLTIP (icon->priv->tooltip),
-					 icon->priv->ebox);
-}
-
-static void
-rb_tray_icon_construct_tooltip (RBTrayIcon *icon)
-{
-	GtkWidget *hbox, *vbox, *image;
-	gint size;
-	PangoFontDescription *font_desc;
+	if (icon->priv->secondary_markup != NULL) {
+		markup = g_strdup_printf ("<big><b>%s</b></big>\n\n%s",
+					  esc_primary,
+					  icon->priv->secondary_markup);
+	} else {
+		markup = g_strdup_printf ("<big><b>%s</b></big>", esc_primary);
+	}
 
-	icon->priv->tooltips_pointer_above = FALSE;
-	icon->priv->tooltips_sticky = FALSE;
-	icon->priv->tooltips_suppressed = FALSE;
-	icon->priv->tooltip = sexy_tooltip_new ();
+	gtk_tooltip_set_markup (tooltip, markup);
 
-	g_signal_connect_object (icon->priv->tooltip, "size-allocate",
-				 (GCallback) rb_tray_icon_tooltip_size_allocate_cb,
-				 icon, G_CONNECT_SWAPPED | G_CONNECT_AFTER);
-
-	icon->priv->tooltip_primary = gtk_label_new (TRAY_ICON_DEFAULT_TOOLTIP);
-	gtk_widget_modify_font (icon->priv->tooltip_primary, NULL);
-	size = pango_font_description_get_size (icon->priv->tooltip_primary->style->font_desc);
-	font_desc = pango_font_description_new ();
-	pango_font_description_set_weight (font_desc, PANGO_WEIGHT_BOLD);
-	pango_font_description_set_size (font_desc, size * PANGO_SCALE_LARGE);
-	gtk_widget_modify_font (icon->priv->tooltip_primary, font_desc);
-	pango_font_description_free (font_desc);
-	gtk_label_set_line_wrap (GTK_LABEL (icon->priv->tooltip_primary),
-				 TRUE);
-	gtk_misc_set_alignment  (GTK_MISC  (icon->priv->tooltip_primary),
-				 0.0, 0.0);
-
-	icon->priv->tooltip_secondary = gtk_label_new (NULL);
-	gtk_widget_set_no_show_all (icon->priv->tooltip_secondary, TRUE);
-	gtk_label_set_line_wrap (GTK_LABEL (icon->priv->tooltip_secondary),
-				 TRUE);
-	gtk_misc_set_alignment  (GTK_MISC  (icon->priv->tooltip_secondary),
-				 0.0, 0.0);
-
-	image = rb_tray_icon_create_blank_image (icon);
-	icon->priv->tooltip_image_box = gtk_vbox_new (FALSE, 12);
-	gtk_box_pack_start (GTK_BOX (icon->priv->tooltip_image_box), image,
-			    FALSE, FALSE, 0);
-
-	hbox = gtk_hbox_new (FALSE, 12);
-	vbox = gtk_vbox_new (FALSE, 12);
-
-	gtk_box_pack_start (GTK_BOX (vbox), icon->priv->tooltip_primary,
-			    FALSE, FALSE, 0);
-	gtk_box_pack_start (GTK_BOX (vbox), icon->priv->tooltip_secondary,
-			    TRUE, TRUE, 0);
-	gtk_box_pack_start (GTK_BOX (hbox), icon->priv->tooltip_image_box,
-			    FALSE, FALSE, 0);
-	gtk_box_pack_start (GTK_BOX (hbox), vbox,
-			    TRUE, TRUE, 0);
-	gtk_widget_show_all (hbox);
+	g_free (esc_primary);
+	g_free (markup);
 
-	gtk_container_add (GTK_CONTAINER (icon->priv->tooltip), hbox);
+	return TRUE;
 }
 
 static gboolean
@@ -954,19 +812,16 @@
 	icon->priv->tooltip_unsuppress_id = g_timeout_add (duration, (GSourceFunc) rb_tray_icon_unsuppress_cb, icon);
 }
 
-static GtkWidget*
+static GdkPixbuf *
 rb_tray_icon_create_blank_image (RBTrayIcon *icon)
 {
 	int width;
 	GdkPixbuf *pixbuf;
-	GtkWidget *image;
 
 	gtk_icon_size_lookup (GTK_ICON_SIZE_DIALOG, &width, NULL);
 	pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, width, width);
 	gdk_pixbuf_fill (pixbuf, 0); /* transparent */
-	image = gtk_image_new_from_pixbuf (pixbuf);
-	g_object_unref (pixbuf);
 
-	return image;
+	return pixbuf;
 }
 

Modified: trunk/shell/rb-tray-icon.h
==============================================================================
--- trunk/shell/rb-tray-icon.h	(original)
+++ trunk/shell/rb-tray-icon.h	Sun Dec 21 11:39:47 2008
@@ -70,14 +70,14 @@
 void                    rb_tray_icon_notify     (RBTrayIcon *icon,
 						 guint timeout,
 						 const char *primary_markup,
-						 GtkWidget *msgicon,
+						 GdkPixbuf *pixbuf,
 						 const char *secondary_markup,
 						 gboolean requested);
 
 void                    rb_tray_icon_cancel_notify (RBTrayIcon *icon);
 
 void rb_tray_icon_set_tooltip_primary_text (RBTrayIcon *icon, const char *primary_text);
-void rb_tray_icon_set_tooltip_icon (RBTrayIcon *icon, GtkWidget *msgicon);
+void rb_tray_icon_set_tooltip_icon (RBTrayIcon *icon, GdkPixbuf *pixbuf);
 void rb_tray_icon_set_tooltip_secondary_markup (RBTrayIcon *icon, const char *secondary_markup);
 
 G_END_DECLS

Modified: trunk/widgets/eggtrayicon.c
==============================================================================
--- trunk/widgets/eggtrayicon.c	(original)
+++ trunk/widgets/eggtrayicon.c	Sun Dec 21 11:39:47 2008
@@ -550,7 +550,7 @@
 egg_tray_icon_notify (EggTrayIcon *icon,
 		      guint timeout,
 		      const char *primary_markup,
-		      GtkWidget *msgicon,
+		      GdkPixbuf *pixbuf,
 		      const char *secondary_markup)
 {
 #ifdef HAVE_NOTIFY
@@ -590,20 +590,13 @@
 
   notify_notification_set_timeout (icon->notify->handle, timeout);
 
-  if (msgicon)
+  if (pixbuf)
     {
-      GdkPixbuf *pixbuf;
-
-      pixbuf = g_object_ref (gtk_image_get_pixbuf (GTK_IMAGE (msgicon)));
-      if (pixbuf)
-	{
 #if (LIBNOTIFY_VERSION_MAJOR == 0 && LIBNOTIFY_VERSION_MINOR <=3 && LIBNOTIFY_VERSION_MICRO < 2)
-	  notify_notification_set_icon_data_from_pixbuf (icon->notify->handle, pixbuf);
+      notify_notification_set_icon_data_from_pixbuf (icon->notify->handle, pixbuf);
 #else
-	  notify_notification_set_icon_from_pixbuf (icon->notify->handle, pixbuf);
+      notify_notification_set_icon_from_pixbuf (icon->notify->handle, pixbuf);
 #endif
-	  g_object_unref (pixbuf);
-	}
     }
 
   gdk_window_get_origin (GTK_WIDGET (icon)->window, &x, &y);

Modified: trunk/widgets/eggtrayicon.h
==============================================================================
--- trunk/widgets/eggtrayicon.h	(original)
+++ trunk/widgets/eggtrayicon.h	Sun Dec 21 11:39:47 2008
@@ -89,7 +89,7 @@
 void 	     egg_tray_icon_notify         (EggTrayIcon *icon,
 					   guint timeout,
 					   const char *primary_markup,
-					   GtkWidget *msgicon,
+					   GdkPixbuf  *pixbuf,
 					   const char *secondary_markup);
 
 GtkOrientation egg_tray_icon_get_orientation (EggTrayIcon *icon);

Modified: trunk/widgets/libsexy/Makefile.am
==============================================================================
--- trunk/widgets/libsexy/Makefile.am	(original)
+++ trunk/widgets/libsexy/Makefile.am	Sun Dec 21 11:39:47 2008
@@ -2,9 +2,7 @@
 
 libsexy_la_SOURCES =		\
 	sexy-icon-entry.h	\
-	sexy-icon-entry.c	\
-	sexy-tooltip.h		\
-	sexy-tooltip.c
+	sexy-icon-entry.c
 
 libsexy_la_LIBADD = $(RHYTHMBOX_LIBS)
 



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