From fe604c42ebf644bd808ba5ca728455a87d51bbad Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 10 Aug 2010 11:28:19 -0500 Subject: Adding the ordering id property. --- src/app-indicator.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'src/app-indicator.c') diff --git a/src/app-indicator.c b/src/app-indicator.c index 22b9c03..0b9b10e 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -112,7 +112,8 @@ enum { PROP_MENU, PROP_CONNECTED, PROP_LABEL, - PROP_LABEL_GUIDE + PROP_LABEL_GUIDE, + PROP_ORDERING_ID }; /* The strings so that they can be slowly looked up. */ @@ -126,6 +127,7 @@ enum { #define PROP_CONNECTED_S "connected" #define PROP_LABEL_S "label" #define PROP_LABEL_GUIDE_S "label-guide" +#define PROP_ORDERING_ID_S "ordering-id" /* Private macro, shhhh! */ #define APP_INDICATOR_GET_PRIVATE(o) \ @@ -330,6 +332,25 @@ app_indicator_class_init (AppIndicatorClass *klass) "To ensure that the label does not cause the panel to 'jiggle' this string should provide information on how much space it could take.", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + AppIndicator:ordering-id: + + The ordering ID is an odd parameter, and if you think you don't need + it you're probably right. In general, the application indicator try + to place the applications in a recreatable place taking into account + which category they're in to try and group them. But, there are some + cases where you'd want to ensure indicators are next to each other. + To do that you can override the generated ordering ID and replace it + with a new one. Again, you probably don't want to be doing this, but + in case you do, this is the way. + */ + g_object_class_install_property(object_class, + PROP_ORDERING_ID, + g_param_spec_uint (PROP_ORDERING_ID_S, + "The location that this app indicator should be in the list.", + "A way to override the default ordering of the applications by providing a very specific idea of where this entry should be placed.", + 0, G_MAXUINT32, 0, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /* Signals */ -- cgit v1.2.3 From 5bffdaf7141fd7909474daa23ff9107c6f047453 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 10 Aug 2010 11:43:42 -0500 Subject: Brining generate-id into the fold --- src/app-indicator.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/app-indicator.c') diff --git a/src/app-indicator.c b/src/app-indicator.c index 0b9b10e..3ba2cfb 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -43,6 +43,7 @@ License version 3 and version 2.1 along with this program. If not, see #include "notification-watcher-client.h" #include "dbus-shared.h" +#include "generate-id.h" #define PANEL_ICON_SUFFIX "panel" -- cgit v1.2.3 From 220d6a305dcfaa0671d7304696f2d8fb1df28431 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 10 Aug 2010 11:56:49 -0500 Subject: Storing the value and allowing the get to use a generated value. --- src/app-indicator.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/app-indicator.c') diff --git a/src/app-indicator.c b/src/app-indicator.c index 3ba2cfb..4395452 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -74,6 +74,7 @@ struct _AppIndicatorPrivate { gchar *icon_theme_path; DbusmenuServer *menuservice; GtkWidget *menu; + guint32 ordering_id; gchar * label; gchar * label_guide; guint label_change_idle; @@ -468,6 +469,7 @@ app_indicator_init (AppIndicator *self) priv->icon_theme_path = NULL; priv->menu = NULL; priv->menuservice = NULL; + priv->ordering_id = 0; priv->label = NULL; priv->label_guide = NULL; priv->label_change_idle = 0; @@ -716,6 +718,9 @@ app_indicator_set_property (GObject * object, guint prop_id, const GValue * valu } break; } + case PROP_ORDERING_ID: + priv->ordering_id = g_value_get_uint(value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -782,6 +787,14 @@ app_indicator_get_property (GObject * object, guint prop_id, GValue * value, GPa g_value_set_string (value, priv->label_guide); break; + case PROP_ORDERING_ID: + if (priv->ordering_id == 0) { + g_value_set_uint(value, generate_id(priv->category, priv->id)); + } else { + g_value_set_uint(value, priv->ordering_id); + } + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; -- cgit v1.2.3 From f04dd0919da6d41443fcea69b4adb83a70fde781 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 10 Aug 2010 13:49:19 -0500 Subject: Providing accessors for the ordering_id property --- src/app-indicator.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'src/app-indicator.c') diff --git a/src/app-indicator.c b/src/app-indicator.c index 4395452..377fda5 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -1819,6 +1819,27 @@ app_indicator_set_menu (AppIndicator *self, GtkMenu *menu) self); } +/** + app_indicator_set_ordering_id: + @self: The #AppIndicator + @ordering_id: A value for the ordering of this app indicator + + Sets the ordering ID for the app indicator which effects the + placement of it on the panel. For almost all app indicator + this is not the function you're looking for. + + Wrapper function for property #AppIndicator:ordering-id. +**/ +void +app_indicator_set_ordering_id (AppIndicator *self, guint32 ordering_id) +{ + g_return_if_fail (IS_APP_INDICATOR (self)); + + self->priv->ordering_id = ordering_id; + + return; +} + /** app_indicator_get_id: @self: The #AppIndicator object to use @@ -1968,3 +1989,25 @@ app_indicator_get_label_guide (AppIndicator *self) return self->priv->label_guide; } +/** + app_indicator_get_ordering_id: + @self: The #AppIndicator object to use + + Wrapper function for property #AppIndicator:ordering-id. + + Return value: The current ordering ID. +*/ +guint32 +app_indicator_get_ordering_id (AppIndicator *self) +{ + g_return_val_if_fail (IS_APP_INDICATOR (self), 0); + + guint ordering_id = 0; + + g_object_get(G_OBJECT(self), + PROP_ORDERING_ID_S, &ordering_id, + NULL); + + return ordering_id; +} + -- cgit v1.2.3 From 06c01943864dd55759d2f4372237b98d6262f903 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 10 Aug 2010 14:17:42 -0500 Subject: I like 'index' better than 'id' -- now everything is consistent. --- src/app-indicator.c | 54 ++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'src/app-indicator.c') diff --git a/src/app-indicator.c b/src/app-indicator.c index 377fda5..e4138d4 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -74,7 +74,7 @@ struct _AppIndicatorPrivate { gchar *icon_theme_path; DbusmenuServer *menuservice; GtkWidget *menu; - guint32 ordering_id; + guint32 ordering_index; gchar * label; gchar * label_guide; guint label_change_idle; @@ -115,7 +115,7 @@ enum { PROP_CONNECTED, PROP_LABEL, PROP_LABEL_GUIDE, - PROP_ORDERING_ID + PROP_ORDERING_INDEX }; /* The strings so that they can be slowly looked up. */ @@ -129,7 +129,7 @@ enum { #define PROP_CONNECTED_S "connected" #define PROP_LABEL_S "label" #define PROP_LABEL_GUIDE_S "label-guide" -#define PROP_ORDERING_ID_S "ordering-id" +#define PROP_ORDERING_INDEX_S "ordering-index" /* Private macro, shhhh! */ #define APP_INDICATOR_GET_PRIVATE(o) \ @@ -335,20 +335,20 @@ app_indicator_class_init (AppIndicatorClass *klass) NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** - AppIndicator:ordering-id: + AppIndicator:ordering-index: - The ordering ID is an odd parameter, and if you think you don't need + The ordering index is an odd parameter, and if you think you don't need it you're probably right. In general, the application indicator try to place the applications in a recreatable place taking into account which category they're in to try and group them. But, there are some cases where you'd want to ensure indicators are next to each other. - To do that you can override the generated ordering ID and replace it + To do that you can override the generated ordering index and replace it with a new one. Again, you probably don't want to be doing this, but in case you do, this is the way. */ g_object_class_install_property(object_class, - PROP_ORDERING_ID, - g_param_spec_uint (PROP_ORDERING_ID_S, + PROP_ORDERING_INDEX, + g_param_spec_uint (PROP_ORDERING_INDEX_S, "The location that this app indicator should be in the list.", "A way to override the default ordering of the applications by providing a very specific idea of where this entry should be placed.", 0, G_MAXUINT32, 0, @@ -469,7 +469,7 @@ app_indicator_init (AppIndicator *self) priv->icon_theme_path = NULL; priv->menu = NULL; priv->menuservice = NULL; - priv->ordering_id = 0; + priv->ordering_index = 0; priv->label = NULL; priv->label_guide = NULL; priv->label_change_idle = 0; @@ -718,8 +718,8 @@ app_indicator_set_property (GObject * object, guint prop_id, const GValue * valu } break; } - case PROP_ORDERING_ID: - priv->ordering_id = g_value_get_uint(value); + case PROP_ORDERING_INDEX: + priv->ordering_index = g_value_get_uint(value); break; default: @@ -787,11 +787,11 @@ app_indicator_get_property (GObject * object, guint prop_id, GValue * value, GPa g_value_set_string (value, priv->label_guide); break; - case PROP_ORDERING_ID: - if (priv->ordering_id == 0) { + case PROP_ORDERING_INDEX: + if (priv->ordering_index == 0) { g_value_set_uint(value, generate_id(priv->category, priv->id)); } else { - g_value_set_uint(value, priv->ordering_id); + g_value_set_uint(value, priv->ordering_index); } break; @@ -1820,22 +1820,22 @@ app_indicator_set_menu (AppIndicator *self, GtkMenu *menu) } /** - app_indicator_set_ordering_id: + app_indicator_set_ordering_index: @self: The #AppIndicator - @ordering_id: A value for the ordering of this app indicator + @ordering_index: A value for the ordering of this app indicator - Sets the ordering ID for the app indicator which effects the + Sets the ordering index for the app indicator which effects the placement of it on the panel. For almost all app indicator this is not the function you're looking for. - Wrapper function for property #AppIndicator:ordering-id. + Wrapper function for property #AppIndicator:ordering-index. **/ void -app_indicator_set_ordering_id (AppIndicator *self, guint32 ordering_id) +app_indicator_set_ordering_index (AppIndicator *self, guint32 ordering_index) { g_return_if_fail (IS_APP_INDICATOR (self)); - self->priv->ordering_id = ordering_id; + self->priv->ordering_index = ordering_index; return; } @@ -1990,24 +1990,24 @@ app_indicator_get_label_guide (AppIndicator *self) } /** - app_indicator_get_ordering_id: + app_indicator_get_ordering_index: @self: The #AppIndicator object to use - Wrapper function for property #AppIndicator:ordering-id. + Wrapper function for property #AppIndicator:ordering-index. - Return value: The current ordering ID. + Return value: The current ordering index. */ guint32 -app_indicator_get_ordering_id (AppIndicator *self) +app_indicator_get_ordering_index (AppIndicator *self) { g_return_val_if_fail (IS_APP_INDICATOR (self), 0); - guint ordering_id = 0; + guint ordering_index = 0; g_object_get(G_OBJECT(self), - PROP_ORDERING_ID_S, &ordering_id, + PROP_ORDERING_INDEX_S, &ordering_index, NULL); - return ordering_id; + return ordering_index; } -- cgit v1.2.3 From 73018411f1b744face28d15b2b73612b11726aba Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 11 Aug 2010 13:00:39 -0500 Subject: Making it so that applications will pass '0' over dbus if they don't have a set ordering index. --- src/app-indicator.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'src/app-indicator.c') diff --git a/src/app-indicator.c b/src/app-indicator.c index e4138d4..781b630 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -788,11 +788,7 @@ app_indicator_get_property (GObject * object, guint prop_id, GValue * value, GPa break; case PROP_ORDERING_INDEX: - if (priv->ordering_index == 0) { - g_value_set_uint(value, generate_id(priv->category, priv->id)); - } else { - g_value_set_uint(value, priv->ordering_index); - } + g_value_set_uint(value, priv->ordering_index); break; default: @@ -2002,12 +1998,10 @@ app_indicator_get_ordering_index (AppIndicator *self) { g_return_val_if_fail (IS_APP_INDICATOR (self), 0); - guint ordering_index = 0; - - g_object_get(G_OBJECT(self), - PROP_ORDERING_INDEX_S, &ordering_index, - NULL); - - return ordering_index; + if (self->priv->ordering_index == 0) { + return generate_id(self->priv->category, self->priv->id); + } else { + return self->priv->ordering_index; + } } -- cgit v1.2.3 From 818f7c466b1a06cea9a70e11abcfc0fba13a37c7 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 11 Aug 2010 13:02:20 -0500 Subject: Putting the ordering index into the 'x' domain. --- src/app-indicator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/app-indicator.c') diff --git a/src/app-indicator.c b/src/app-indicator.c index 781b630..240e1ca 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -129,7 +129,7 @@ enum { #define PROP_CONNECTED_S "connected" #define PROP_LABEL_S "label" #define PROP_LABEL_GUIDE_S "label-guide" -#define PROP_ORDERING_INDEX_S "ordering-index" +#define PROP_ORDERING_INDEX_S "x-ayatana-ordering-index" /* Private macro, shhhh! */ #define APP_INDICATOR_GET_PRIVATE(o) \ -- cgit v1.2.3 From ea682be679779ba60d98393f2d613e8c980b3fd2 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 11 Aug 2010 13:24:27 -0500 Subject: Adding a set of wrapper properties that can be used by the dbus interface. --- src/app-indicator.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'src/app-indicator.c') diff --git a/src/app-indicator.c b/src/app-indicator.c index 22b9c03..3f7c85f 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -112,7 +112,9 @@ enum { PROP_MENU, PROP_CONNECTED, PROP_LABEL, - PROP_LABEL_GUIDE + PROP_LABEL_GUIDE, + PROP_X_LABEL, + PROP_X_LABEL_GUIDE }; /* The strings so that they can be slowly looked up. */ @@ -126,6 +128,8 @@ enum { #define PROP_CONNECTED_S "connected" #define PROP_LABEL_S "label" #define PROP_LABEL_GUIDE_S "label-guide" +#define PROP_X_LABEL_S "x-ayatana-label" +#define PROP_X_LABEL_GUIDE_S "x-ayatana-label-guide" /* Private macro, shhhh! */ #define APP_INDICATOR_GET_PRIVATE(o) \ @@ -331,6 +335,32 @@ app_indicator_class_init (AppIndicatorClass *klass) NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + AppIndicator:x-ayatana-label: + + Wrapper for #AppIndicator:label. Please use that in all of your + code. + */ + g_object_class_install_property(object_class, + PROP_X_LABEL, + g_param_spec_string (PROP_X_LABEL_S, + "A wrapper, please don't use.", + "A wrapper, please don't use.", + NULL, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + AppIndicator:x-ayatana-label-guide: + + Wrapper for #AppIndicator:label-guide. Please use that in all of your + code. + */ + g_object_class_install_property(object_class, + PROP_X_LABEL_GUIDE, + g_param_spec_string (PROP_X_LABEL_GUIDE_S, + "A wrapper, please don't use.", + "A wrapper, please don't use.", + NULL, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /* Signals */ @@ -658,6 +688,7 @@ app_indicator_set_property (GObject * object, guint prop_id, const GValue * valu check_connect (self); break; + case PROP_X_LABEL: case PROP_LABEL: { gchar * oldlabel = priv->label; priv->label = g_value_dup_string(value); @@ -676,6 +707,7 @@ app_indicator_set_property (GObject * object, guint prop_id, const GValue * valu } break; } + case PROP_X_LABEL_GUIDE: case PROP_LABEL_GUIDE: { gchar * oldguide = priv->label_guide; priv->label_guide = g_value_dup_string(value); -- cgit v1.2.3 From 1fbc480b06ae2596b2644134d3c906ef3ba15f8e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 11 Aug 2010 13:43:36 -0500 Subject: Adding in a wrapper signal --- src/app-indicator.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/app-indicator.c') diff --git a/src/app-indicator.c b/src/app-indicator.c index 3f7c85f..e174e57 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -92,6 +92,7 @@ enum { NEW_ATTENTION_ICON, NEW_STATUS, NEW_LABEL, + X_NEW_LABEL, CONNECTION_CHANGED, NEW_ICON_THEME_PATH, LAST_SIGNAL @@ -135,6 +136,9 @@ enum { #define APP_INDICATOR_GET_PRIVATE(o) \ (G_TYPE_INSTANCE_GET_PRIVATE ((o), APP_INDICATOR_TYPE, AppIndicatorPrivate)) +/* Signal wrapper */ +#define APP_INDICATOR_SIGNAL_X_NEW_LABEL ("x-ayatana-" APP_INDICATOR_SIGNAL_NEW_LABEL) + /* Default Path */ #define DEFAULT_ITEM_PATH "/org/ayatana/NotificationItem" @@ -425,6 +429,23 @@ app_indicator_class_init (AppIndicatorClass *klass) _application_service_marshal_VOID__STRING_STRING, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); + /** + AppIndicator::x-ayatana-new-label: + @arg0: The #AppIndicator object + @arg1: The string for the label + @arg1: The string for the guide + + Wrapper for #AppIndicator::new-label, please don't use this signal + use the other one. + */ + signals[X_NEW_LABEL] = g_signal_new (APP_INDICATOR_SIGNAL_X_NEW_LABEL, + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (AppIndicatorClass, new_label), + NULL, NULL, + _application_service_marshal_VOID__STRING_STRING, + G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); + /** AppIndicator::connection-changed: @arg0: The #AppIndicator object @@ -811,6 +832,10 @@ signal_label_change_idle (gpointer user_data) priv->label != NULL ? priv->label : "", priv->label_guide != NULL ? priv->label_guide : "", TRUE); + g_signal_emit(G_OBJECT(self), signals[X_NEW_LABEL], 0, + priv->label != NULL ? priv->label : "", + priv->label_guide != NULL ? priv->label_guide : "", + TRUE); priv->label_change_idle = 0; -- cgit v1.2.3 From 7330f014db03391d1859f74b4bcbef13e587aa52 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 11 Aug 2010 14:11:18 -0500 Subject: Adding the wrapper properties to the get. --- src/app-indicator.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/app-indicator.c') diff --git a/src/app-indicator.c b/src/app-indicator.c index e174e57..cd8dcc9 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -805,10 +805,12 @@ app_indicator_get_property (GObject * object, guint prop_id, GValue * value, GPa g_value_set_boolean (value, priv->watcher_proxy != NULL ? TRUE : FALSE); break; + case PROP_X_LABEL: case PROP_LABEL: g_value_set_string (value, priv->label); break; + case PROP_X_LABEL_GUIDE: case PROP_LABEL_GUIDE: g_value_set_string (value, priv->label_guide); break; -- cgit v1.2.3 From 9346cf3923b01a8ee557c3a0273a445962759391 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 11 Aug 2010 14:27:33 -0500 Subject: Making a wrapper property for the 'X' domain --- src/app-indicator.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src/app-indicator.c') diff --git a/src/app-indicator.c b/src/app-indicator.c index 240e1ca..7528da2 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -115,7 +115,8 @@ enum { PROP_CONNECTED, PROP_LABEL, PROP_LABEL_GUIDE, - PROP_ORDERING_INDEX + PROP_ORDERING_INDEX, + PROP_X_ORDERING_INDEX }; /* The strings so that they can be slowly looked up. */ @@ -129,7 +130,8 @@ enum { #define PROP_CONNECTED_S "connected" #define PROP_LABEL_S "label" #define PROP_LABEL_GUIDE_S "label-guide" -#define PROP_ORDERING_INDEX_S "x-ayatana-ordering-index" +#define PROP_ORDERING_INDEX_S "ordering-index" +#define PROP_X_ORDERING_INDEX_S ("x-ayatana-" PROP_ORDERING_INDEX_S) /* Private macro, shhhh! */ #define APP_INDICATOR_GET_PRIVATE(o) \ @@ -353,6 +355,20 @@ app_indicator_class_init (AppIndicatorClass *klass) "A way to override the default ordering of the applications by providing a very specific idea of where this entry should be placed.", 0, G_MAXUINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + /** + AppIndicator:x-ayatana-ordering-index: + + A wrapper for #AppIndicator:ordering-index so that it can match the + dbus interface currently. It will hopefully be retired, please don't + use it anywhere. + */ + g_object_class_install_property(object_class, + PROP_X_ORDERING_INDEX, + g_param_spec_uint (PROP_X_ORDERING_INDEX_S, + "A wrapper, please don't use.", + "A wrapper, please don't use.", + 0, G_MAXUINT32, 0, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /* Signals */ @@ -718,6 +734,7 @@ app_indicator_set_property (GObject * object, guint prop_id, const GValue * valu } break; } + case PROP_X_ORDERING_INDEX: case PROP_ORDERING_INDEX: priv->ordering_index = g_value_get_uint(value); break; @@ -787,6 +804,7 @@ app_indicator_get_property (GObject * object, guint prop_id, GValue * value, GPa g_value_set_string (value, priv->label_guide); break; + case PROP_X_ORDERING_INDEX: case PROP_ORDERING_INDEX: g_value_set_uint(value, priv->ordering_index); break; -- cgit v1.2.3