From bbfcf3d6dfc5f34d722b3be252d9b1e5b9f4ecb7 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Fri, 4 Sep 2020 02:37:09 +0200 Subject: src/indicator-notifications.c: Add separator after notification list. Fixes AyatanaIndicators/ayatana-indicator-notifications#8. --- src/indicator-notifications.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/indicator-notifications.c b/src/indicator-notifications.c index 56ddd7a..dffa57c 100644 --- a/src/indicator-notifications.c +++ b/src/indicator-notifications.c @@ -72,6 +72,7 @@ struct _IndicatorNotificationsPrivate { GtkWidget *clear_item; GtkWidget *clear_item_label; GtkWidget *settings_item; + GtkWidget *pSeparator; gchar *accessible_desc; @@ -204,6 +205,9 @@ indicator_notifications_init(IndicatorNotifications *self) gtk_menu_shell_prepend(GTK_MENU_SHELL(self->priv->menu), self->priv->clear_item); + self->priv->pSeparator = gtk_separator_menu_item_new(); + gtk_menu_shell_prepend(GTK_MENU_SHELL(self->priv->menu), self->priv->pSeparator); + /* Watch for notifications from dbus */ self->priv->spy = dbus_spy_new(); g_signal_connect(self->priv->spy, DBUS_SPY_SIGNAL_MESSAGE_RECEIVED, G_CALLBACK(message_received_cb), self); @@ -527,9 +531,15 @@ update_clear_item_markup(IndicatorNotifications *self) gtk_label_set_markup(GTK_LABEL(self->priv->clear_item_label), markup); g_free(markup); - if (total_length == 0) { - gtk_menu_shell_deactivate(GTK_MENU_SHELL(self->priv->menu)); - } + if (total_length == 0) + { + gtk_widget_hide(self->priv->pSeparator); + gtk_menu_shell_deactivate(GTK_MENU_SHELL(self->priv->menu)); + } + else + { + gtk_widget_show(self->priv->pSeparator); + } } /** -- cgit v1.2.3