Back to index

bamf  0.2.120
Classes | Defines | Typedefs | Functions
bamf-indicator.h File Reference
#include <time.h>
#include <glib-object.h>
#include <libbamf/bamf-view.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _BamfIndicator
struct  _BamfIndicatorClass

Defines

#define BAMF_TYPE_INDICATOR   (bamf_indicator_get_type ())
#define BAMF_INDICATOR(obj)
#define BAMF_INDICATOR_CLASS(klass)
#define BAMF_IS_INDICATOR(obj)
#define BAMF_IS_INDICATOR_CLASS(klass)
#define BAMF_INDICATOR_GET_CLASS(obj)

Typedefs

typedef struct _BamfIndicator
typedef struct _BamfIndicatorClass
typedef struct _BamfIndicatorPrivate

Functions

GType bamf_indicator_get_type (void) G_GNUC_CONST
const gchar * bamf_indicator_get_remote_path (BamfIndicator *self)
const gchar * bamf_indicator_get_remote_address (BamfIndicator *self)
const gchar * bamf_indicator_get_dbus_menu_path (BamfIndicator *self)

Class Documentation

struct _BamfIndicator

Definition at line 57 of file bamf-indicator.h.

Class Members
BamfView parent
BamfIndicatorPrivate * priv

Define Documentation

#define BAMF_INDICATOR (   obj)
Value:
(G_TYPE_CHECK_INSTANCE_CAST ((obj),\
        BAMF_TYPE_INDICATOR, BamfIndicator))

Definition at line 38 of file bamf-indicator.h.

#define BAMF_INDICATOR_CLASS (   klass)
Value:
(G_TYPE_CHECK_CLASS_CAST ((klass),\
        BAMF_TYPE_INDICATOR, BamfIndicatorClass))

Definition at line 41 of file bamf-indicator.h.

#define BAMF_INDICATOR_GET_CLASS (   obj)
Value:
(G_TYPE_INSTANCE_GET_CLASS ((obj),\
        BAMF_TYPE_INDICATOR, BamfIndicatorClass))

Definition at line 50 of file bamf-indicator.h.

#define BAMF_IS_INDICATOR (   obj)
Value:
(G_TYPE_CHECK_INSTANCE_TYPE ((obj),\
        BAMF_TYPE_INDICATOR))

Definition at line 44 of file bamf-indicator.h.

#define BAMF_IS_INDICATOR_CLASS (   klass)
Value:
(G_TYPE_CHECK_CLASS_TYPE ((klass),\
        BAMF_TYPE_INDICATOR))

Definition at line 47 of file bamf-indicator.h.

Definition at line 36 of file bamf-indicator.h.


Typedef Documentation

typedef struct _BamfIndicator

Definition at line 53 of file bamf-indicator.h.

typedef struct _BamfIndicatorClass

Definition at line 54 of file bamf-indicator.h.

typedef struct _BamfIndicatorPrivate

Definition at line 55 of file bamf-indicator.h.


Function Documentation

const gchar* bamf_indicator_get_dbus_menu_path ( BamfIndicator *  self)

Definition at line 59 of file bamf-indicator.c.

{
  BamfIndicatorPrivate *priv;
  gchar *path = NULL;
  DBusGProxy *proxy;
  GValue value = {0};
  GError *error = NULL;

  g_return_val_if_fail (BAMF_IS_INDICATOR (self), NULL);
  priv = self->priv;
  
  if (priv->dbus_menu)
    return priv->dbus_menu;
  
  if (!_bamf_view_remote_ready (BAMF_VIEW (self)))
    return NULL;
  
  proxy = dbus_g_proxy_new_for_name (priv->connection,
                                     bamf_indicator_get_remote_address (self),
                                     bamf_indicator_get_remote_path (self),
                                     "org.freedesktop.DBus.Properties");
  
  if (!dbus_g_proxy_call (proxy,
                          "Get",
                          &error,
                          G_TYPE_STRING, "org.kde.StatusNotifierItem",
                          G_TYPE_STRING, "Menu",
                          G_TYPE_INVALID,
                          G_TYPE_VALUE, &value,
                          G_TYPE_INVALID))
    {
      g_warning ("Failed to fetch remote path: %s", error->message);
      g_error_free (error);
      
      return NULL;
    }
  
  path = g_value_get_boxed (&value);
  priv->dbus_menu = path;

  g_object_unref (proxy);
  return priv->dbus_menu;
}

Here is the call graph for this function:

Here is the caller graph for this function:

const gchar* bamf_indicator_get_remote_address ( BamfIndicator *  self)

Definition at line 138 of file bamf-indicator.c.

{
  BamfIndicatorPrivate *priv;
  char *address = NULL;
  GError *error = NULL;

  g_return_val_if_fail (BAMF_IS_INDICATOR (self), NULL);
  priv = self->priv;
  
  if (priv->address)
    return priv->address;
  
  if (!_bamf_view_remote_ready (BAMF_VIEW (self)))
    return NULL;
  
  if (!dbus_g_proxy_call (priv->proxy,
                          "Address",
                          &error,
                          G_TYPE_INVALID,
                          G_TYPE_STRING, &address,
                          G_TYPE_INVALID))
    {
      g_warning ("Failed to fetch remote path: %s", error->message);
      g_error_free (error);
      
      return NULL;
    }

  priv->address = address;

  return address;
}

Here is the call graph for this function:

Here is the caller graph for this function:

const gchar* bamf_indicator_get_remote_path ( BamfIndicator *  self)

Definition at line 104 of file bamf-indicator.c.

{
  BamfIndicatorPrivate *priv;
  char *path = NULL;
  GError *error = NULL;

  g_return_val_if_fail (BAMF_IS_INDICATOR (self), NULL);
  priv = self->priv;
  
  if (priv->path)
    return priv->path;
  
  if (!_bamf_view_remote_ready (BAMF_VIEW (self)))
    return NULL;
  
  if (!dbus_g_proxy_call (priv->proxy,
                          "Path",
                          &error,
                          G_TYPE_INVALID,
                          G_TYPE_STRING, &path,
                          G_TYPE_INVALID))
    {
      g_warning ("Failed to fetch remote path: %s", error->message);
      g_error_free (error);
      
      return NULL;
    }

  priv->path = path;

  return path;
}

Here is the call graph for this function:

Here is the caller graph for this function:

GType bamf_indicator_get_type ( void  )