Back to index

dbus-test-runner  12.10.0
Functions | Variables
test-libdbustest-getname.c File Reference
#include <glib.h>
#include <gio/gio.h>

Go to the source code of this file.

Functions

void name_acquired (GDBusConnection *connection, const gchar *name, gpointer user_data)
void name_lost (GDBusConnection *connection, const gchar *name, gpointer user_data)
int main (int argc, gchar *argv[])

Variables

GMainLoop * mainloop = NULL
gboolean error = FALSE

Function Documentation

int main ( int  argc,
gchar *  argv[] 
)

Definition at line 25 of file test-libdbustest-getname.c.

{
       if (argc != 2) {
              g_critical("Need a name");
              return -1;
       }

       g_type_init();

       guint name = g_bus_own_name(G_BUS_TYPE_SESSION,
                                   argv[1], /* name */
                                   G_BUS_NAME_OWNER_FLAGS_NONE, /* flags */
                                   NULL, /* bus acquired */
                                   name_acquired, /* name acquired */
                                   name_lost, /* name lost */
                                   NULL, /* user data */
                                   NULL /* ud free */
                                   );

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

       g_bus_unown_name(name);

       if (error) {
              return -1;
       } else {
              return 0;
       }
}

Here is the call graph for this function:

void name_acquired ( GDBusConnection *  connection,
const gchar *  name,
gpointer  user_data 
)

Definition at line 9 of file test-libdbustest-getname.c.

{
       g_main_loop_quit(mainloop);
       return;
}

Here is the caller graph for this function:

void name_lost ( GDBusConnection *  connection,
const gchar *  name,
gpointer  user_data 
)

Definition at line 16 of file test-libdbustest-getname.c.

{
       g_warning("Name lost!");
       error = TRUE;
       g_main_loop_quit(mainloop);
       return;
}

Here is the caller graph for this function:


Variable Documentation

gboolean error = FALSE

Definition at line 6 of file test-libdbustest-getname.c.

GMainLoop* mainloop = NULL

Definition at line 5 of file test-libdbustest-getname.c.