Back to index

bamf  0.2.120
Classes | Defines | Functions | Variables
bamf-control.c File Reference
#include "bamf-control.h"
#include <dbus/dbus.h>
#include <dbus/dbus-glib.h>

Go to the source code of this file.

Classes

struct  _BamfControlPrivate

Defines

#define BAMF_CONTROL_GET_PRIVATE(o)   (G_TYPE_INSTANCE_GET_PRIVATE ((o), BAMF_TYPE_CONTROL, BamfControlPrivate))

Functions

 G_DEFINE_TYPE (BamfControl, bamf_control, G_TYPE_OBJECT)
 SECTION:bamf-control : The base class for all controls.
static void bamf_control_dispose (GObject *object)
static void bamf_control_class_init (BamfControlClass *klass)
static void bamf_control_init (BamfControl *self)
BamfControl * bamf_control_get_default (void)
void bamf_control_set_approver_behavior (BamfControl *control, gint32 behavior)
void bamf_control_insert_desktop_file (BamfControl *control, const gchar *desktop_file)
void bamf_control_register_application_for_pid (BamfControl *control, const gchar *application, gint32 pid)
void bamf_control_register_tab_provider (BamfControl *control, const char *path)

Variables

static BamfControl * default_control = NULL

Class Documentation

struct _BamfControlPrivate

Definition at line 47 of file bamf-control.c.

Class Members
DBusGConnection * connection
DBusGProxy * proxy
GList * sources

Define Documentation

#define BAMF_CONTROL_GET_PRIVATE (   o)    (G_TYPE_INSTANCE_GET_PRIVATE ((o), BAMF_TYPE_CONTROL, BamfControlPrivate))

Definition at line 44 of file bamf-control.c.


Function Documentation

static void bamf_control_class_init ( BamfControlClass *  klass) [static]

Definition at line 78 of file bamf-control.c.

{
  GObjectClass *obj_class = G_OBJECT_CLASS (klass);

  g_type_class_add_private (obj_class, sizeof (BamfControlPrivate));
  obj_class->dispose = bamf_control_dispose;
}

Here is the call graph for this function:

static void bamf_control_dispose ( GObject *  object) [static]

Definition at line 63 of file bamf-control.c.

{
  BamfControl *self = BAMF_CONTROL (object);

  if (self->priv->proxy)
    {
      g_object_unref (self->priv->proxy);
      self->priv->proxy = NULL;
    }

  if (G_OBJECT_CLASS (bamf_control_parent_class)->dispose)
      G_OBJECT_CLASS (bamf_control_parent_class)->dispose (object);
}

Here is the caller graph for this function:

BamfControl* bamf_control_get_default ( void  )

Definition at line 116 of file bamf-control.c.

{
  if (BAMF_IS_CONTROL (default_control))
    return g_object_ref (default_control);

  return (default_control = g_object_new (BAMF_TYPE_CONTROL, NULL));
}

Here is the caller graph for this function:

static void bamf_control_init ( BamfControl *  self) [static]

Definition at line 88 of file bamf-control.c.

{
  BamfControlPrivate *priv;
  GError           *error = NULL;

  priv = self->priv = BAMF_CONTROL_GET_PRIVATE (self);

  priv->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
  if (priv->connection == NULL)
    {
      g_warning ("Failed to open connection to bus: %s",
               error != NULL ? error->message : "Unknown");
      if (error)
        g_error_free (error);
      return;
    }

  priv->proxy = dbus_g_proxy_new_for_name (priv->connection,
                                           "org.ayatana.bamf",
                                           "/org/ayatana/bamf/control",
                                           "org.ayatana.bamf.control");
  if (priv->proxy == NULL)
    {
      g_error ("Unable to get org.bamf.Control control");
    }
}
void bamf_control_insert_desktop_file ( BamfControl *  control,
const gchar *  desktop_file 
)

Definition at line 147 of file bamf-control.c.

{
  BamfControlPrivate *priv;
  GError *error = NULL;

  g_return_if_fail (BAMF_IS_CONTROL (control));
  priv = control->priv;

  if (!dbus_g_proxy_call (priv->proxy,
                          "OmNomNomDesktopFile",
                          &error,
                          G_TYPE_STRING, desktop_file,
                          G_TYPE_INVALID,
                          G_TYPE_INVALID))
    {
      g_warning ("Failed to insert desktop file: %s", error->message);
      g_error_free (error);
    }
}

Here is the caller graph for this function:

void bamf_control_register_application_for_pid ( BamfControl *  control,
const gchar *  application,
gint32  pid 
)

Definition at line 169 of file bamf-control.c.

{
  BamfControlPrivate *priv;
  GError *error = NULL;

  g_return_if_fail (BAMF_IS_CONTROL (control));
  priv = control->priv;

  if (!dbus_g_proxy_call (priv->proxy,
                          "RegisterApplicationForPid",
                          &error,
                          G_TYPE_STRING, application,
                          G_TYPE_UINT, pid,
                          G_TYPE_INVALID,
                          G_TYPE_INVALID))
    {
      g_warning ("Failed to register application: %s", error->message);
      g_error_free (error);
    }
}

Here is the caller graph for this function:

void bamf_control_register_tab_provider ( BamfControl *  control,
const char *  path 
)

Definition at line 193 of file bamf-control.c.

{
}

Here is the caller graph for this function:

void bamf_control_set_approver_behavior ( BamfControl *  control,
gint32  behavior 
)

Definition at line 125 of file bamf-control.c.

{
  BamfControlPrivate *priv;
  GError *error = NULL;

  g_return_if_fail (BAMF_IS_CONTROL (control));
  priv = control->priv;

  if (!dbus_g_proxy_call (priv->proxy,
                          "SetApproverBehavior",
                          &error,
                          G_TYPE_INT, behavior,
                          G_TYPE_INVALID,
                          G_TYPE_INVALID))
    {
      g_warning ("Failed to register application: %s", error->message);
      g_error_free (error);
    }
}

Here is the caller graph for this function:

G_DEFINE_TYPE ( BamfControl  ,
bamf_control  ,
G_TYPE_OBJECT   
)

SECTION:bamf-control : The base class for all controls.

BamfControl is the base class that all controls need to derive from.


Variable Documentation

BamfControl* default_control = NULL [static]

Definition at line 54 of file bamf-control.c.