File notification-daemon-new-bubble.patch of Package notification-daemon

This patch needs a newbubble directory in src/themes/ which is a copy of
the standard directory. This way, we easily create a theme based on the
standard theme.

We add an internal engine API so that the engine can specify if it wants
to always stack notifications.

We give a style name to the notification window so the GTK+ theme can
change the colors of the stripe. Here's an example:

style "notification-magic"
{
        base[NORMAL] = "#ffcb88" # background color of the notification window
        bg[NORMAL] = "#defc12" # color of the stripe (low urgency)
        bg[SELECTED] = "#76bf6f" # color of the stripe (normal urgency)
}

widget "notification-window.GtkEventBox.GtkVBox"   style "notification-magic"

Index: notification-daemon-0.3.7/src/daemon/daemon.c
===================================================================
--- notification-daemon-0.3.7.orig/src/daemon/daemon.c
+++ notification-daemon-0.3.7/src/daemon/daemon.c
@@ -1276,7 +1276,7 @@ notify_daemon_notify_handler(NotifyDaemo
 		 * sync_notification_position later.
 		 */
 	}
-	else if (use_pos_data)
+	else if (use_pos_data && !theme_get_always_stack(nw))
 	{
 		/*
 		 * Typically, the theme engine will set its own position based on
Index: notification-daemon-0.3.7/src/daemon/engines.c
===================================================================
--- notification-daemon-0.3.7.orig/src/daemon/engines.c
+++ notification-daemon-0.3.7/src/daemon/engines.c
@@ -30,6 +30,7 @@ typedef struct
 	void (*move_notification)(GtkWindow *nw, int x, int y);
 	void (*set_notification_timeout)(GtkWindow *nw, glong timeout);
 	void (*notification_tick)(GtkWindow *nw, glong timeout);
+	gboolean (*get_always_stack)(GtkWindow *nw);
 
 } ThemeEngine;
 
@@ -83,6 +84,7 @@ load_theme_engine(const char *name)
 	BIND_OPTIONAL_FUNC(set_notification_timeout);
 	BIND_OPTIONAL_FUNC(set_notification_hints);
 	BIND_OPTIONAL_FUNC(notification_tick);
+	BIND_OPTIONAL_FUNC(get_always_stack);
 
 	if (!engine->theme_check_init(NOTIFICATION_DAEMON_MAJOR_VERSION,
 								  NOTIFICATION_DAEMON_MINOR_VERSION,
@@ -293,3 +295,14 @@ theme_move_notification(GtkWindow *nw, i
 	ThemeEngine *engine = g_object_get_data(G_OBJECT(nw), "_theme_engine");
 	engine->move_notification(nw, x, y);
 }
+
+gboolean
+theme_get_always_stack(GtkWindow *nw)
+{
+	ThemeEngine *engine = g_object_get_data(G_OBJECT(nw), "_theme_engine");
+
+	if (engine->get_always_stack != NULL)
+		return engine->get_always_stack(nw);
+	else
+		return FALSE;
+}
Index: notification-daemon-0.3.7/src/daemon/engines.h
===================================================================
--- notification-daemon-0.3.7.orig/src/daemon/engines.h
+++ notification-daemon-0.3.7/src/daemon/engines.h
@@ -21,5 +21,6 @@ void theme_add_notification_action(GtkWi
 								   const char *key, GCallback cb);
 void theme_clear_notification_actions(GtkWindow *nw);
 void theme_move_notification(GtkWindow *nw, int x, int y);
+gboolean theme_get_always_stack(GtkWindow *nw);
 
 #endif /* _ENGINES_H_ */
Index: notification-daemon-0.3.7/src/themes/Makefile.am
===================================================================
--- notification-daemon-0.3.7.orig/src/themes/Makefile.am
+++ notification-daemon-0.3.7/src/themes/Makefile.am
@@ -1,2 +1,2 @@
-SUBDIRS = standard
+SUBDIRS = standard newbubble
 DIST_SUBDIRS = $(SUBDIRS) bubble
Index: notification-daemon-0.3.7/src/themes/newbubble/theme.c
===================================================================
--- notification-daemon-0.3.7.orig/src/themes/newbubble/theme.c
+++ notification-daemon-0.3.7/src/themes/newbubble/theme.c
@@ -609,6 +609,7 @@ create_notification(UrlClickedCb url_cli
 	gtk_window_set_type_hint(GTK_WINDOW(win),
 							 GDK_WINDOW_TYPE_HINT_NOTIFICATION);
 	gtk_widget_add_events(win, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
+	gtk_widget_set_name(win, "notification-window");
 	gtk_widget_realize(win);
 	gtk_widget_set_size_request(win, WIDTH, -1);
 
@@ -1015,7 +1016,7 @@ get_theme_info(char **theme_name,
 			   char **author,
 			   char **homepage)
 {
-	*theme_name = g_strdup("Standard");
+	*theme_name = g_strdup("Bubble");
 	*theme_ver  = g_strdup_printf("%d.%d.%d",
 								  NOTIFICATION_DAEMON_MAJOR_VERSION,
 								  NOTIFICATION_DAEMON_MINOR_VERSION,
@@ -1032,3 +1033,9 @@ theme_check_init(unsigned int major_ver,
 	       minor_ver == NOTIFICATION_DAEMON_MINOR_VERSION &&
 	       micro_ver == NOTIFICATION_DAEMON_MICRO_VERSION;
 }
+
+gboolean
+get_always_stack(GtkWidget *nw)
+{
+	return TRUE;
+}
Index: notification-daemon-0.3.7/configure.ac
===================================================================
--- notification-daemon-0.3.7.orig/configure.ac
+++ notification-daemon-0.3.7/configure.ac
@@ -201,6 +201,7 @@ src/Makefile
 src/daemon/Makefile
 src/themes/Makefile
 src/themes/bubble/Makefile
+src/themes/newbubble/Makefile
 src/themes/standard/Makefile
 ])
 
openSUSE Build Service is sponsored by