Back to index

libindicate  12.10.0
Functions | Variables
test-properties-server.c File Reference
#include <glib.h>
#include "libindicate/listener.h"

Go to the source code of this file.

Functions

static void string_cb (IndicateListener *listener, IndicateListenerServer *server, IndicateListenerIndicator *indicator, gchar *property, const gchar *propertydata, gpointer data)
static void int_cb (IndicateListener *listener, IndicateListenerServer *server, IndicateListenerIndicator *indicator, gchar *property, gint propertydata, gpointer data)
static void bool_cb (IndicateListener *listener, IndicateListenerServer *server, IndicateListenerIndicator *indicator, gchar *property, gboolean propertydata, gpointer data)
static void indicator_added (IndicateListener *listener, IndicateListenerServer *server, IndicateListenerIndicator *indicator, gpointer data)
static gboolean failed_cb (gpointer data)
int main (int argc, char *argv)

Variables

static gboolean passed = TRUE
static GMainLoop * mainloop = NULL
static gint tests = 0

Function Documentation

static void bool_cb ( IndicateListener *  listener,
IndicateListenerServer *  server,
IndicateListenerIndicator *  indicator,
gchar *  property,
gboolean  propertydata,
gpointer  data 
) [static]

Definition at line 40 of file test-properties-server.c.

{
       g_debug("Got bool property '%s' value '%d'", property, propertydata);
       if (propertydata != GPOINTER_TO_INT(data)) {
              passed = FALSE;
              g_debug("\tExpecting '%d'", GPOINTER_TO_INT(data));
       }
       tests--;
       if (tests == 0) {
              g_main_loop_quit(mainloop);
       }
       return;
}

Here is the caller graph for this function:

static gboolean failed_cb ( gpointer  data) [static]

Definition at line 72 of file test-properties-server.c.

{
       g_debug("Failed to get a server in 5 seconds.");
       passed = FALSE;
       g_main_loop_quit(mainloop);
       return FALSE;
}

Here is the caller graph for this function:

static void indicator_added ( IndicateListener *  listener,
IndicateListenerServer *  server,
IndicateListenerIndicator *  indicator,
gpointer  data 
) [static]

Definition at line 55 of file test-properties-server.c.

{
       g_debug("Indicator Added:   %s %d", INDICATE_LISTENER_SERVER_DBUS_NAME(server), indicate_listener_indicator_get_id(indicator));

       indicate_listener_get_property(listener, server, indicator, "string-value", string_cb, "my-value");
       tests++;
       indicate_listener_get_property_int(listener, server, indicator, "int-value", int_cb, GINT_TO_POINTER(42));
       tests++;
       indicate_listener_get_property_bool(listener, server, indicator, "bool-value", bool_cb, GINT_TO_POINTER(TRUE));
       tests++;
       indicate_listener_get_property_bool(listener, server, indicator, "no-bool-value", bool_cb, GINT_TO_POINTER(FALSE));
       tests++;

       return;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void int_cb ( IndicateListener *  listener,
IndicateListenerServer *  server,
IndicateListenerIndicator *  indicator,
gchar *  property,
gint  propertydata,
gpointer  data 
) [static]

Definition at line 25 of file test-properties-server.c.

{
       g_debug("Got int property '%s' value '%d'", property, propertydata);
       if (propertydata != GPOINTER_TO_INT(data)) {
              passed = FALSE;
              g_debug("\tExpecting '%d'", GPOINTER_TO_INT(data));
       }
       tests--;
       if (tests == 0) {
              g_main_loop_quit(mainloop);
       }
       return;
}

Here is the caller graph for this function:

int main ( int  argc,
char *  argv 
)

Definition at line 81 of file test-properties-server.c.

{
       g_type_init();

       IndicateListener * listener = indicate_listener_ref_default();

       g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_INDICATOR_ADDED, G_CALLBACK(indicator_added), NULL);

       g_timeout_add_seconds(5, failed_cb, NULL);

       mainloop = g_main_loop_new(NULL, FALSE);
       g_main_loop_run(mainloop);

       return !passed;
}

Here is the call graph for this function:

static void string_cb ( IndicateListener *  listener,
IndicateListenerServer *  server,
IndicateListenerIndicator *  indicator,
gchar *  property,
const gchar *  propertydata,
gpointer  data 
) [static]

Definition at line 10 of file test-properties-server.c.

{
       g_debug("Got string property '%s' value '%s'", property, propertydata);
       if (g_strcmp0(propertydata, (gchar *)data)) {
              passed = FALSE;
              g_debug("\tExpecting '%s'", (gchar *)data);
       }
       tests--;
       if (tests == 0) {
              g_main_loop_quit(mainloop);
       }
       return;
}

Here is the caller graph for this function:


Variable Documentation

GMainLoop* mainloop = NULL [static]

Definition at line 6 of file test-properties-server.c.

gboolean passed = TRUE [static]

Definition at line 5 of file test-properties-server.c.

gint tests = 0 [static]

Definition at line 7 of file test-properties-server.c.