Back to index

libindicate  12.10.0
Classes | Defines | Typedefs | Functions
indicator.h File Reference
#include <glib.h>
#include <glib-object.h>
#include "server.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _IndicateIndicator
 IndicateIndicator: More...
struct  _IndicateIndicatorClass
 IndicateIndicatorClass: : Parent class #GObjectClass. More...

Defines

#define INDICATE_TYPE_INDICATOR   (indicate_indicator_get_type ())
#define INDICATE_INDICATOR(object)   (G_TYPE_CHECK_INSTANCE_CAST ((object), INDICATE_TYPE_INDICATOR, IndicateIndicator))
#define INDICATE_IS_INDICATOR(object)   (G_TYPE_CHECK_INSTANCE_TYPE((object), INDICATE_TYPE_INDICATOR))
#define INDICATE_INDICATOR_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST((klass), INDICATE_TYPE_INDICATOR, IndicateIndicatorClass))
#define INDICATE_IS_INDICATOR_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE((klass), INDICATE_TYPE_INDICATOR))
#define INDICATE_INDICATOR_GET_CLASS(object)   (G_TYPE_INSTANCE_GET_CLASS((object), INDICATE_TYPE_INDICATOR, IndicateIndicatorClass))
#define INDICATE_INDICATOR_VALUE_TRUE   "true"
#define INDICATE_INDICATOR_VALUE_FALSE   "false"
#define INDICATE_INDICATOR_SIGNAL_HIDE   "hide"
#define INDICATE_INDICATOR_SIGNAL_SHOW   "show"
#define INDICATE_INDICATOR_SIGNAL_DISPLAY   "user-display"
#define INDICATE_INDICATOR_SIGNAL_MODIFIED   "modified"
#define INDICATE_INDICATOR_SIGNAL_DISPLAYED   "displayed"

Typedefs

typedef struct _IndicateIndicator
typedef struct _IndicateIndicatorClass
typedef GPtrArray *(* indicate_indicator_list_properties_slot_t )(IndicateIndicator *indicator)
 indicate_indicator_list_properties_slot_t: : (in): Indicator to get the properties from

Functions

GType indicate_indicator_get_type (void) G_GNUC_CONST
IndicateIndicator * indicate_indicator_new (void)
 indicate_indicator_get_type:
IndicateIndicator * indicate_indicator_new_with_server (IndicateServer *server)
 indicate_indicator_new_with_server: : The server that should be associated with this indicator.
void indicate_indicator_show (IndicateIndicator *indicator)
 indicate_indicator_show: : a #IndicateIndicator to act on
void indicate_indicator_hide (IndicateIndicator *indicator)
 indicate_indicator_hide: : a #IndicateIndicator to act on
gboolean indicate_indicator_is_visible (IndicateIndicator *indicator)
 indicate_indicator_is_visible: : a #IndicateIndicator to act on
void indicate_indicator_set_server (IndicateIndicator *indicator, IndicateServer *server)
 indicate_indicator_set_server: : a #IndicateIndicator to act on : the #IndicateServer which should be associated with
guint indicate_indicator_get_id (IndicateIndicator *indicator)
 indicate_indicator_get_id: : a #IndicateIndicator to act on
IndicateServer * indicate_indicator_get_server (IndicateIndicator *indicator)
 indicate_indicator_get_server: : a #IndicateIndicator to act on
void indicate_indicator_user_display (IndicateIndicator *indicator, guint timestamp)
 indicate_indicator_user_display: : a #IndicateIndicator to act on : The time that the event happened
void indicate_indicator_set_property (IndicateIndicator *indicator, const gchar *key, const gchar *data)
 indicate_indicator_set_property: : a #IndicateIndicator to act on : name of the property : value of the property
void indicate_indicator_set_property_time (IndicateIndicator *indicator, const gchar *key, GTimeVal *time)
 indicate_indicator_set_property_time: : a #IndicateIndicator to act on : name of the property : time to set property with
void indicate_indicator_set_property_int (IndicateIndicator *indicator, const gchar *key, gint value)
 indicate_indicator_set_property_int: : a #IndicateIndicator to act on : name of the property : integer to set property with
void indicate_indicator_set_property_bool (IndicateIndicator *indicator, const gchar *key, gboolean value)
 indicate_indicator_set_property_bool: : a #IndicateIndicator to act on : name of the property : integer to set property with
void indicate_indicator_set_property_variant (IndicateIndicator *indicator, const gchar *key, GVariant *value)
const gchar * indicate_indicator_get_property (IndicateIndicator *indicator, const gchar *key)
 indicate_indicator_get_property: : a #IndicateIndicator to act on : name of the property
GVariant * indicate_indicator_get_property_variant (IndicateIndicator *indicator, const gchar *key)
GPtrArray * indicate_indicator_list_properties (IndicateIndicator *indicator)
 indicate_indicator_list_properties: : (in): a #IndicateIndicator to act on
void indicate_indicator_set_displayed (IndicateIndicator *indicator, gboolean displayed)
 indicate_indicator_set_displayed: : The #IndicateIndicator to configure : Whether or not the indicator is visible to users
gboolean indicate_indicator_get_displayed (IndicateIndicator *indicator)
 indicate_indicator_get_displayed: : The #IndicateIndicator to query

Class Documentation

struct _IndicateIndicator

IndicateIndicator:

The indicator object represents a single item that is shared over the indicator bus. This could be something like one IM, one e-mail or a single system update. It should be accessed only through its accessors.

Definition at line 71 of file indicator.h.

Class Members
GObject parent

Define Documentation

#define INDICATE_INDICATOR (   object)    (G_TYPE_CHECK_INSTANCE_CAST ((object), INDICATE_TYPE_INDICATOR, IndicateIndicator))

Definition at line 40 of file indicator.h.

#define INDICATE_INDICATOR_CLASS (   klass)    (G_TYPE_CHECK_CLASS_CAST((klass), INDICATE_TYPE_INDICATOR, IndicateIndicatorClass))

Definition at line 42 of file indicator.h.

#define INDICATE_INDICATOR_GET_CLASS (   object)    (G_TYPE_INSTANCE_GET_CLASS((object), INDICATE_TYPE_INDICATOR, IndicateIndicatorClass))

Definition at line 44 of file indicator.h.

Definition at line 56 of file indicator.h.

#define INDICATE_INDICATOR_SIGNAL_DISPLAYED   "displayed"

Definition at line 58 of file indicator.h.

#define INDICATE_INDICATOR_SIGNAL_HIDE   "hide"

Definition at line 54 of file indicator.h.

#define INDICATE_INDICATOR_SIGNAL_MODIFIED   "modified"

Definition at line 57 of file indicator.h.

#define INDICATE_INDICATOR_SIGNAL_SHOW   "show"

Definition at line 55 of file indicator.h.

#define INDICATE_INDICATOR_VALUE_FALSE   "false"

Definition at line 49 of file indicator.h.

#define INDICATE_INDICATOR_VALUE_TRUE   "true"

Definition at line 48 of file indicator.h.

#define INDICATE_IS_INDICATOR (   object)    (G_TYPE_CHECK_INSTANCE_TYPE((object), INDICATE_TYPE_INDICATOR))

Definition at line 41 of file indicator.h.

#define INDICATE_IS_INDICATOR_CLASS (   klass)    (G_TYPE_CHECK_CLASS_TYPE((klass), INDICATE_TYPE_INDICATOR))

Definition at line 43 of file indicator.h.

Definition at line 39 of file indicator.h.


Typedef Documentation

typedef struct _IndicateIndicator

Definition at line 60 of file indicator.h.

typedef struct _IndicateIndicatorClass

Definition at line 61 of file indicator.h.

typedef GPtrArray*(* indicate_indicator_list_properties_slot_t)(IndicateIndicator *indicator)

indicate_indicator_list_properties_slot_t: : (in): Indicator to get the properties from

Prototype for a function that will list all the properies in an indicator.

Return value: (transfer full) (array) (element-type utf8): The names of the properties that are in this indicator.

Definition at line 87 of file indicator.h.


Function Documentation

gboolean indicate_indicator_get_displayed ( IndicateIndicator *  indicator)

indicate_indicator_get_displayed: : The #IndicateIndicator to query

Checks to see if the indicator is visible to users in some way.

Return value: Whether or not this indicator can be seen by a user or not.

Definition at line 645 of file indicator.c.

{
       g_return_val_if_fail(INDICATE_IS_INDICATOR(indicator), FALSE);
       IndicateIndicatorPrivate * priv = INDICATE_INDICATOR_GET_PRIVATE(indicator);
       return priv->is_visible && priv->is_displayed;
}
guint indicate_indicator_get_id ( IndicateIndicator *  indicator)

indicate_indicator_get_id: : a #IndicateIndicator to act on

Gets the ID value of the .

Return value: The ID of the indicator. Can not be zero. Zero represents an error.

Definition at line 364 of file indicator.c.

{
       g_return_val_if_fail(INDICATE_IS_INDICATOR(indicator), 0);
       IndicateIndicatorPrivate * priv = INDICATE_INDICATOR_GET_PRIVATE(indicator);
       return priv->id;
}

Here is the caller graph for this function:

const gchar* indicate_indicator_get_property ( IndicateIndicator *  indicator,
const gchar *  key 
)

indicate_indicator_get_property: : a #IndicateIndicator to act on : name of the property

Returns the value that is set for a property or NULL if that property is not set.

Return value: A constant string or NULL.

Definition at line 525 of file indicator.c.

{
       IndicateIndicatorClass * class = INDICATE_INDICATOR_GET_CLASS(indicator);
       if (class->get_property == NULL) {
              return NULL;
       }

       GVariant * val = class->get_property(indicator, key);
       if (val == NULL) {
              return NULL;
       } else {
              return g_variant_get_string(val, NULL);
       }
}
GVariant* indicate_indicator_get_property_variant ( IndicateIndicator *  indicator,
const gchar *  key 
)

Definition at line 541 of file indicator.c.

{
       IndicateIndicatorClass * class = INDICATE_INDICATOR_GET_CLASS(indicator);
       if (class->get_property == NULL) {
              return NULL;
       }

       return class->get_property(indicator, key);
}

Here is the caller graph for this function:

IndicateServer* indicate_indicator_get_server ( IndicateIndicator *  indicator)

indicate_indicator_get_server: : a #IndicateIndicator to act on

Gets the server of the .

Return value: (transfer none): The server associated with the indicator or NULL if error.

Definition at line 381 of file indicator.c.

{
       g_return_val_if_fail(INDICATE_IS_INDICATOR(indicator), NULL);
       IndicateIndicatorPrivate * priv = INDICATE_INDICATOR_GET_PRIVATE(indicator);
       return priv->server;
}

Here is the caller graph for this function:

GType indicate_indicator_get_type ( void  )
void indicate_indicator_hide ( IndicateIndicator *  indicator)

indicate_indicator_hide: : a #IndicateIndicator to act on

Hides the indicator from the bus. Does not effect the indicator's #IndicateServer in any way.

Definition at line 322 of file indicator.c.

{
       IndicateIndicatorPrivate * priv = INDICATE_INDICATOR_GET_PRIVATE(indicator);

       if (!priv->is_visible) {
              return;
       }

       priv->is_visible = FALSE;
       g_signal_emit(indicator, signals[HIDE], 0, TRUE);
       priv->is_displayed = FALSE;
       g_signal_emit(G_OBJECT(indicator), signals[DISPLAYED], 0, priv->is_displayed, TRUE);

       return;
}
gboolean indicate_indicator_is_visible ( IndicateIndicator *  indicator)

indicate_indicator_is_visible: : a #IndicateIndicator to act on

Checkes the visibility status of .

Return value: TRUE if the indicator is visible else FALSE.

Definition at line 347 of file indicator.c.

{
       g_return_val_if_fail(INDICATE_IS_INDICATOR(indicator), FALSE);
       IndicateIndicatorPrivate * priv = INDICATE_INDICATOR_GET_PRIVATE(indicator);
       return priv->is_visible;
}

Here is the caller graph for this function:

GPtrArray* indicate_indicator_list_properties ( IndicateIndicator *  indicator)

indicate_indicator_list_properties: : (in): a #IndicateIndicator to act on

This function gets a list of all the properties that exist on a . The array may have zero entries.

Return value: (transfer full) (array) (element-type utf8): An array of strings that is the keys of all the properties on this indicator.

Definition at line 552 of file indicator.c.

{
       IndicateIndicatorClass * class = INDICATE_INDICATOR_GET_CLASS(indicator);
       if (class->list_properties == NULL) {
              return g_ptr_array_new();
       }

       return class->list_properties(indicator);
}

Here is the caller graph for this function:

IndicateIndicator* indicate_indicator_new ( void  )

indicate_indicator_get_type:

Gets a unique #GType for the #IndicateIndicator objects.

Return value: A unique #GType value. indicate_indicator_new:

Builds a new indicator object using g_object_new().

Return value: A pointer to a new #IndicateIndicator object.

Definition at line 228 of file indicator.c.

{
       IndicateIndicator * indicator = g_object_new(INDICATE_TYPE_INDICATOR, NULL);
       return indicator;
}

Here is the caller graph for this function:

IndicateIndicator* indicate_indicator_new_with_server ( IndicateServer *  server)

indicate_indicator_new_with_server: : The server that should be associated with this indicator.

Builds a new indicator object using g_object_new() and sets the server to the specified server. Also, adds a reference to the server.

Return value: A pointer to a new #IndicateIndicator object.

Definition at line 245 of file indicator.c.

{
       g_return_val_if_fail(server != NULL, NULL);

       IndicateIndicator * indicator = g_object_new(INDICATE_TYPE_INDICATOR, NULL);

       indicate_indicator_set_server (indicator, server);

       return indicator;
}

Here is the call graph for this function:

void indicate_indicator_set_displayed ( IndicateIndicator *  indicator,
gboolean  displayed 
)

indicate_indicator_set_displayed: : The #IndicateIndicator to configure : Whether or not the indicator is visible to users

Sets whether or not the indicator is visible to the user from a listener. This does not include things like whether the menu is open, but more whether it's in the menu to be found.

Definition at line 622 of file indicator.c.

{
       g_return_if_fail(INDICATE_IS_INDICATOR(indicator));
       IndicateIndicatorPrivate * priv = INDICATE_INDICATOR_GET_PRIVATE(indicator);

       if (priv->is_displayed != displayed) {
              priv->is_displayed = displayed;
              g_signal_emit(G_OBJECT(indicator), signals[DISPLAYED], 0, displayed, TRUE);
       }

       return;
}

Here is the caller graph for this function:

void indicate_indicator_set_property ( IndicateIndicator *  indicator,
const gchar *  key,
const gchar *  data 
)

indicate_indicator_set_property: : a #IndicateIndicator to act on : name of the property : value of the property

Sets a simple string property on . If the property had previously been set it will replace it with the new value, otherwise it will create the property. This will include an emition of #IndicateIndicator::modified if the property value was changed.

Definition at line 422 of file indicator.c.

{
       IndicateIndicatorClass * class = INDICATE_INDICATOR_GET_CLASS(indicator);
       if (class->set_property == NULL) {
              return;
       }

       GVariant * variant = g_variant_new_string(data);
       return class->set_property(indicator, key, variant);
}

Here is the caller graph for this function:

void indicate_indicator_set_property_bool ( IndicateIndicator *  indicator,
const gchar *  key,
gboolean  value 
)

indicate_indicator_set_property_bool: : a #IndicateIndicator to act on : name of the property : integer to set property with

This is a helper function that wraps around indicate_indicator_set_property but takes a boolean property and turns into a string and uses that data to call indicate_indicator_set_property.

Definition at line 492 of file indicator.c.

{
       IndicateIndicatorClass * class = INDICATE_INDICATOR_GET_CLASS(indicator);
       if (class->set_property == NULL) {
              return;
       }

       GVariant * variant = g_variant_new_boolean(value);
       return class->set_property(indicator, key, variant);
}

Here is the caller graph for this function:

void indicate_indicator_set_property_int ( IndicateIndicator *  indicator,
const gchar *  key,
gint  value 
)

indicate_indicator_set_property_int: : a #IndicateIndicator to act on : name of the property : integer to set property with

This is a helper function that wraps around indicate_indicator_set_property but takes an integer property and turns into a string and uses that data to call indicate_indicator_set_property.

Definition at line 466 of file indicator.c.

{
       IndicateIndicatorClass * class = INDICATE_INDICATOR_GET_CLASS(indicator);
       if (class->set_property == NULL) {
              return;
       }

       GValue intval = {0};
       g_value_init(&intval, G_TYPE_INT);
       g_value_set_int(&intval, value);

       GVariant * variant = g_variant_new_int32(value);
       return class->set_property(indicator, key, variant);
}

Here is the caller graph for this function:

void indicate_indicator_set_property_time ( IndicateIndicator *  indicator,
const gchar *  key,
GTimeVal *  time 
)

indicate_indicator_set_property_time: : a #IndicateIndicator to act on : name of the property : time to set property with

This is a helper function that wraps around indicate_indicator_set_property but takes an #GTimeVal parameter. It then takes the parameter converts it to an ISO 8601 time string and uses that data to call indicate_indicator_set_property.

Definition at line 445 of file indicator.c.

{
       gchar * timestr = g_time_val_to_iso8601(time);
       if (timestr != NULL) {
              indicate_indicator_set_property(indicator, key, timestr);
              g_free(timestr);
       }
       return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void indicate_indicator_set_property_variant ( IndicateIndicator *  indicator,
const gchar *  key,
GVariant *  value 
)

Definition at line 504 of file indicator.c.

{
       IndicateIndicatorClass * class = INDICATE_INDICATOR_GET_CLASS(indicator);
       if (class->set_property == NULL) {
              return;
       }

       return class->set_property(indicator, key, value);
}
void indicate_indicator_set_server ( IndicateIndicator *  indicator,
IndicateServer *  server 
)

indicate_indicator_set_server: : a #IndicateIndicator to act on : the #IndicateServer which should be associated with

Defines which server this indicator must be associated to. Also, adds a reference to the server.

Definition at line 265 of file indicator.c.

{
       IndicateIndicatorPrivate * priv = INDICATE_INDICATOR_GET_PRIVATE(indicator);

       if (server != NULL) {
              g_object_ref(server);
       }

       if (priv->server != NULL) {
              indicate_server_remove_indicator (priv->server, indicator);
              g_object_unref(priv->server);
       }

       priv->server = server;
       if (server != NULL) {
              indicate_server_add_indicator (server, indicator);
       }

       return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void indicate_indicator_show ( IndicateIndicator *  indicator)

indicate_indicator_show: : a #IndicateIndicator to act on

Shows this indicator on the bus. If the #IndicateServer that it's connected to is not shown itself this function will show the server as well using indicate_server_show.

Definition at line 296 of file indicator.c.

{
       IndicateIndicatorPrivate * priv = INDICATE_INDICATOR_GET_PRIVATE(indicator);

       if (priv->is_visible) {
              return;
       }

       if (priv->server) {
              indicate_server_show(priv->server);
       }

       priv->is_visible = TRUE;
       g_signal_emit(indicator, signals[SHOW], 0, TRUE);

       return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void indicate_indicator_user_display ( IndicateIndicator *  indicator,
guint  timestamp 
)

indicate_indicator_user_display: : a #IndicateIndicator to act on : The time that the event happened

Emits the #IndicateIndicator::user-display signal simliar to a user clicking on over the bus. Signal will not be sent if the is not visible.

Definition at line 398 of file indicator.c.

{
       IndicateIndicatorPrivate * priv = INDICATE_INDICATOR_GET_PRIVATE(indicator);
       if (!priv->is_visible) {
              return;
       }

       g_signal_emit(indicator, signals[USER_DISPLAY], 0, timestamp, TRUE);
       return;
}

Here is the caller graph for this function: