From 585541595135fe2317d9f5065073b09ad10052ca Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 4 Sep 2009 10:46:25 -0500 Subject: We have to drop show_time as a parameter as the caller doesn't really know if that's the case or not anymore. --- src/im-menu-item.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/im-menu-item.h') diff --git a/src/im-menu-item.h b/src/im-menu-item.h index 51414de..8d0c273 100644 --- a/src/im-menu-item.h +++ b/src/im-menu-item.h @@ -53,7 +53,7 @@ struct _ImMenuItem { }; GType im_menu_item_get_type (void); -ImMenuItem * im_menu_item_new (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gboolean show_time); +ImMenuItem * im_menu_item_new (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator); glong im_menu_item_get_seconds (ImMenuItem * menuitem); G_END_DECLS -- cgit v1.2.3 From c3637d885d7800bbcf045436b4b28d19a4b04fb0 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 4 Sep 2009 16:24:55 -0500 Subject: Adding in a signal for when the attention changes. --- src/im-menu-item.c | 8 ++++++++ src/im-menu-item.h | 2 ++ 2 files changed, 10 insertions(+) (limited to 'src/im-menu-item.h') diff --git a/src/im-menu-item.c b/src/im-menu-item.c index 11381cf..fd93cc7 100644 --- a/src/im-menu-item.c +++ b/src/im-menu-item.c @@ -33,6 +33,7 @@ with this program. If not, see . enum { TIME_CHANGED, + ATTENTION_CHANGED, LAST_SIGNAL }; @@ -105,6 +106,13 @@ im_menu_item_class_init (ImMenuItemClass *klass) NULL, NULL, g_cclosure_marshal_VOID__LONG, G_TYPE_NONE, 1, G_TYPE_LONG); + signals[ATTENTION_CHANGED] = g_signal_new(IM_MENU_ITEM_SIGNAL_ATTENTION_CHANGED, + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ImMenuItemClass, attention_changed), + NULL, NULL, + g_cclosure_marshal_VOID__BOOLEAN, + G_TYPE_NONE, 1, G_TYPE_BOOLEAN); return; } diff --git a/src/im-menu-item.h b/src/im-menu-item.h index 8d0c273..5ae4f82 100644 --- a/src/im-menu-item.h +++ b/src/im-menu-item.h @@ -38,6 +38,7 @@ G_BEGIN_DECLS #define IM_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), IM_MENU_ITEM_TYPE, ImMenuItemClass)) #define IM_MENU_ITEM_SIGNAL_TIME_CHANGED "time-changed" +#define IM_MENU_ITEM_SIGNAL_ATTENTION_CHANGED "attention-changed" typedef struct _ImMenuItem ImMenuItem; typedef struct _ImMenuItemClass ImMenuItemClass; @@ -46,6 +47,7 @@ struct _ImMenuItemClass { DbusmenuMenuitemClass parent_class; void (*time_changed) (glong seconds); + void (*attention_changed) (gboolean requestit); }; struct _ImMenuItem { -- cgit v1.2.3 From 9533ec199b1fb11a911de5d8859f946af6a6f060 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 4 Sep 2009 16:29:00 -0500 Subject: Adding an attention variable and a function to access it. --- src/im-menu-item.c | 17 +++++++++++++++++ src/im-menu-item.h | 1 + 2 files changed, 18 insertions(+) (limited to 'src/im-menu-item.h') diff --git a/src/im-menu-item.c b/src/im-menu-item.c index fd93cc7..ee91f71 100644 --- a/src/im-menu-item.c +++ b/src/im-menu-item.c @@ -50,6 +50,7 @@ struct _ImMenuItemPrivate glong seconds; gchar * count; gulong indicator_changed; + gboolean attention; guint time_update_min; }; @@ -387,6 +388,7 @@ im_menu_item_new (IndicateListener * listener, IndicateListenerServer * server, priv->indicator = indicator; priv->count = NULL; priv->time_update_min = 0; + priv->attention = FALSE; dbusmenu_menuitem_property_set(DBUSMENU_MENUITEM(self), "type", INDICATOR_MENUITEM_TYPE); @@ -403,9 +405,24 @@ im_menu_item_new (IndicateListener * listener, IndicateListenerServer * server, return self; } +/* Gets the number of seconds for the creator + of this item. */ glong im_menu_item_get_seconds (ImMenuItem * menuitem) { + g_return_val_if_fail(IS_IM_MENU_ITEM(menuitem), 0); + ImMenuItemPrivate * priv = IM_MENU_ITEM_GET_PRIVATE(menuitem); return priv->seconds; } + +/* Gets whether or not this indicator item is + asking for attention or not. */ +gboolean +im_menu_item_get_attention (ImMenuItem * menuitem) +{ + g_return_val_if_fail(IS_IM_MENU_ITEM(menuitem), FALSE); + + ImMenuItemPrivate * priv = IM_MENU_ITEM_GET_PRIVATE(menuitem); + return priv->attention; +} diff --git a/src/im-menu-item.h b/src/im-menu-item.h index 5ae4f82..1ec9bf0 100644 --- a/src/im-menu-item.h +++ b/src/im-menu-item.h @@ -57,6 +57,7 @@ struct _ImMenuItem { GType im_menu_item_get_type (void); ImMenuItem * im_menu_item_new (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator); glong im_menu_item_get_seconds (ImMenuItem * menuitem); +gboolean im_menu_item_get_attention (ImMenuItem * menuitem); G_END_DECLS -- cgit v1.2.3 From e8505fb54db95018b89d29682f507fbb8e56cad2 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 4 Sep 2009 17:31:29 -0500 Subject: Adding in a small function to access the show variable. --- src/im-menu-item.c | 12 ++++++++++++ src/im-menu-item.h | 1 + 2 files changed, 13 insertions(+) (limited to 'src/im-menu-item.h') diff --git a/src/im-menu-item.c b/src/im-menu-item.c index 7f82dba..03cea5e 100644 --- a/src/im-menu-item.c +++ b/src/im-menu-item.c @@ -482,3 +482,15 @@ im_menu_item_show (ImMenuItem * menuitem, gboolean show) return; } + +/* Check to see if this item is shown. Accessor for the + internal variable. */ +gboolean +im_menu_item_shown (ImMenuItem * menuitem) +{ + g_return_val_if_fail(IS_IM_MENU_ITEM(menuitem), FALSE); + + ImMenuItemPrivate * priv = IM_MENU_ITEM_GET_PRIVATE(menuitem); + + return priv->show; +} diff --git a/src/im-menu-item.h b/src/im-menu-item.h index 244c32a..4279c2e 100644 --- a/src/im-menu-item.h +++ b/src/im-menu-item.h @@ -59,6 +59,7 @@ ImMenuItem * im_menu_item_new (IndicateListener * listener, IndicateListenerServ glong im_menu_item_get_seconds (ImMenuItem * menuitem); gboolean im_menu_item_get_attention (ImMenuItem * menuitem); void im_menu_item_show (ImMenuItem * menuitem, gboolean show); +gboolean im_menu_item_shown (ImMenuItem * menuitem); G_END_DECLS -- cgit v1.2.3