← Back to team overview

ayatana-commits team mailing list archive

[Branch ~indicator-applet-developers/indicator-messages/trunk] Rev 183: Fixes to the placement of notifications and their visibility. Lots of lovely cleanups.

 

Merge authors:
  Ted Gould (ted)
Related merge proposals:
  https://code.launchpad.net/~ted/indicator-messages/notification-grouping/+merge/22546
  proposed by: Ted Gould (ted)
------------------------------------------------------------
revno: 183 [merge]
committer: Ted Gould <ted@xxxxxxxx>
branch nick: trunk
timestamp: Wed 2010-03-31 22:02:37 -0500
message:
  Fixes to the placement of notifications and their visibility.  Lots of lovely cleanups.
modified:
  src/app-menu-item.c
  src/indicator-messages.c
  src/messages-service.c


--
lp:indicator-messages
https://code.launchpad.net/~indicator-applet-developers/indicator-messages/trunk

Your team ayatana-commits is subscribed to branch lp:indicator-messages.
To unsubscribe from this branch go to https://code.launchpad.net/~indicator-applet-developers/indicator-messages/trunk/+edit-subscription
=== modified file 'src/app-menu-item.c'
--- src/app-menu-item.c	2010-03-25 15:28:25 +0000
+++ src/app-menu-item.c	2010-03-31 03:25:19 +0000
@@ -128,6 +128,8 @@
 	priv->root = NULL;
 	priv->shortcuts = NULL;
 
+	dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
+
 	return;
 }
 
@@ -317,6 +319,8 @@
 
 	priv->desktop = g_strdup(value);
 
+	dbusmenu_menuitem_property_set_bool(DBUSMENU_MENUITEM(self), DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
+
 	update_label(self);
 
 	const gchar * def_icon = get_default_icon(priv->desktop);

=== modified file 'src/indicator-messages.c'
--- src/indicator-messages.c	2010-03-30 14:38:30 +0000
+++ src/indicator-messages.c	2010-03-31 05:24:02 +0000
@@ -384,8 +384,6 @@
 				g_object_unref(resized_pixbuf);
 			}
 		}
-	} else {
-		g_warning("Indicator Item property '%s' unknown", prop);
 	}
 
 	return;
@@ -467,7 +465,7 @@
 	dbusmenu_gtkclient_newitem_base(DBUSMENU_GTKCLIENT(client), newitem, gmi, parent);
 
 	g_signal_connect(G_OBJECT(newitem), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(indicator_prop_change_cb), mi_data);
-	g_signal_connect(G_OBJECT(newitem), "destroyed", G_CALLBACK(g_free), mi_data);
+	g_object_weak_ref(G_OBJECT(newitem), (GWeakNotify)g_free, mi_data);
 
 	return TRUE;
 }

=== modified file 'src/messages-service.c'
--- src/messages-service.c	2010-03-29 22:37:15 +0000
+++ src/messages-service.c	2010-03-31 14:54:24 +0000
@@ -562,10 +562,6 @@
 	sl_item->attention = FALSE;
 	sl_item->count = 0;
 
-	/* Build a separator */
-	sl_item->separator = dbusmenu_menuitem_new();
-	dbusmenu_menuitem_property_set(sl_item->separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR);
-
 	/* Incase we got an indicator first */
 	GList * alreadythere = g_list_find_custom(serverList, sl_item, serverList_equal);
 	if (alreadythere != NULL) {
@@ -579,6 +575,10 @@
 		serverList = g_list_insert_sorted(serverList, sl_item, serverList_sort);
 	}
 
+	/* Build a separator */
+	sl_item->separator = dbusmenu_menuitem_new();
+	dbusmenu_menuitem_property_set(sl_item->separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR);
+
 	/* Connect the signals up to the menu item */
 	g_signal_connect(G_OBJECT(menuitem), APP_MENU_ITEM_SIGNAL_COUNT_CHANGED, G_CALLBACK(server_count_changed), sl_item);
 	g_signal_connect(G_OBJECT(menuitem), APP_MENU_ITEM_SIGNAL_NAME_CHANGED,  G_CALLBACK(server_name_changed),  menushell);
@@ -794,15 +794,16 @@
 
 	if (msl->found) return;
 
-	msl->position++;
-
 	if (!IS_APP_MENU_ITEM(data_mi)) {
+		msl->position++;
 		return;
 	}
 
 	AppMenuItem * appmenu = APP_MENU_ITEM(data_mi);
 	if (!g_strcmp0(INDICATE_LISTENER_SERVER_DBUS_NAME((IndicateListenerServer*)msl->server), INDICATE_LISTENER_SERVER_DBUS_NAME(app_menu_item_get_server(appmenu)))) {
 		msl->found = TRUE;
+	} else {
+		msl->position++;
 	}
 
 	return;
@@ -904,6 +905,13 @@
 
 			if (imi->menuitem != NULL) {
 				g_debug("\tMoving indicator on %s id %d to position %d", INDICATE_LISTENER_SERVER_DBUS_NAME(imi->server), INDICATE_LISTENER_INDICATOR_ID(imi->indicator), position);
+
+				if (si->menuitem == NULL || !dbusmenu_menuitem_property_get_bool(DBUSMENU_MENUITEM(si->menuitem), DBUSMENU_MENUITEM_PROP_VISIBLE)) {
+					dbusmenu_menuitem_property_set_bool(imi->menuitem, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
+				} else {
+					dbusmenu_menuitem_property_set_bool(imi->menuitem, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
+				}
+
 				dbusmenu_menuitem_child_reorder(DBUSMENU_MENUITEM(menushell), DBUSMENU_MENUITEM(imi->menuitem), position);
 				position++;
 			}
@@ -912,10 +920,17 @@
 		/* Lastly putting the separator in */
 		if (si->separator != NULL) {
 			g_debug("\tMoving app %s separator to position %d", INDICATE_LISTENER_SERVER_DBUS_NAME(si->server), position);
+
+			if (si->menuitem == NULL || !dbusmenu_menuitem_property_get_bool(DBUSMENU_MENUITEM(si->menuitem), DBUSMENU_MENUITEM_PROP_VISIBLE)) {
+				dbusmenu_menuitem_property_set_bool(si->separator, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
+				/* Note, this isn't the last if we can't see it */
+			} else {
+				dbusmenu_menuitem_property_set_bool(si->separator, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
+				last_separator = si->separator;
+			}
+
 			dbusmenu_menuitem_child_reorder(DBUSMENU_MENUITEM(menushell), DBUSMENU_MENUITEM(si->separator), position);
-			dbusmenu_menuitem_property_set_bool(si->separator, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
 			position++;
-			last_separator = si->separator;
 		}
 	}