Back to index

bamf  0.2.120
Classes | Defines | Enumerations | Functions
bamf-tab.c File Reference
#include "bamf-tab.h"
#include "bamf-tab-source.h"

Go to the source code of this file.

Classes

struct  _BamfTabPrivate

Defines

#define BAMF_TAB_GET_PRIVATE(obj)

Enumerations

enum  { PROP_0, PROP_ID, PROP_SOURCE }

Functions

static void bamf_tab_dbus_iface_init (BamfDBusItemTabIface *iface)
 G_DEFINE_TYPE_WITH_CODE (BamfTab, bamf_tab, BAMF_TYPE_VIEW, G_IMPLEMENT_INTERFACE(BAMF_DBUS_ITEM_TYPE_TAB, bamf_tab_dbus_iface_init))
char * bamf_tab_current_uri (BamfTab *self)
void bamf_tab_show (BamfTab *tab)
guint32 bamf_tab_parent_xid (BamfTab *tab)
gchar * bamf_tab_get_preview (BamfTab *tab)
static const char * bamf_tab_get_view_type (BamfView *view)
static void on_tab_source_uri_changed (BamfTabSource *source, char *id, char *old_uri, char *new_uri, BamfTab *self)
static void on_uri_changed (BamfTab *self, const gchar *old_uri, const gchar *new_uri, gpointer _not_used)
static gboolean on_dbus_handle_show_tab (BamfDBusItemTab *interface, GDBusMethodInvocation *invocation, BamfTab *self)
static gboolean on_dbus_handle_parent_xid (BamfDBusItemTab *interface, GDBusMethodInvocation *invocation, BamfTab *self)
static gboolean on_dbus_handle_current_uri (BamfDBusItemTab *interface, GDBusMethodInvocation *invocation, BamfTab *self)
static gboolean on_dbus_handle_preview (BamfDBusItemTab *interface, GDBusMethodInvocation *invocation, BamfTab *self)
static void bamf_tab_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
static void bamf_tab_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
static void bamf_tab_constructed (GObject *object)
static void bamf_tab_dispose (GObject *object)
static void bamf_tab_finalize (GObject *object)
static void bamf_tab_init (BamfTab *self)
static void bamf_tab_class_init (BamfTabClass *klass)
BamfTab * bamf_tab_new (BamfTabSource *source, const char *id)

Class Documentation

struct _BamfTabPrivate

Definition at line 48 of file bamf-tab.c.

Class Members
BamfDBusItemTab * dbus_iface
char * id
gchar * id
gchar * preview_uri
BamfTabSource * source
char * uri
gchar * uri

Define Documentation

#define BAMF_TAB_GET_PRIVATE (   obj)
Value:
(G_TYPE_INSTANCE_GET_PRIVATE(obj, \
BAMF_TYPE_TAB, BamfTabPrivate))

Definition at line 24 of file bamf-tab.c.


Enumeration Type Documentation

anonymous enum
Enumerator:
PROP_0 
PROP_ID 
PROP_SOURCE 

Definition at line 32 of file bamf-tab.c.


Function Documentation

static void bamf_tab_class_init ( BamfTabClass *  klass) [static]

Definition at line 282 of file bamf-tab.c.

{
  GParamSpec *pspec;
  GObjectClass *object_class = G_OBJECT_CLASS (klass);
  BamfViewClass *view_class = BAMF_VIEW_CLASS (klass);

  object_class->constructed  = bamf_tab_constructed;
  object_class->get_property = bamf_tab_get_property;
  object_class->set_property = bamf_tab_set_property;
  object_class->dispose      = bamf_tab_dispose;
  object_class->finalize     = bamf_tab_finalize;
  view_class->view_type      = bamf_tab_get_view_type;

  pspec = g_param_spec_string ("id", "id", "id", NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
  g_object_class_install_property (object_class, PROP_ID, pspec);

  pspec = g_param_spec_object ("source", "source", "source", BAMF_TYPE_TAB_SOURCE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
  g_object_class_install_property (object_class, PROP_SOURCE, pspec);

  g_type_class_add_private (klass, sizeof (BamfTabPrivate));
}

Here is the call graph for this function:

static void bamf_tab_constructed ( GObject *  object) [static]

Definition at line 204 of file bamf-tab.c.

{
  BamfTab *self;

  if (G_OBJECT_CLASS (bamf_tab_parent_class)->constructed)
    G_OBJECT_CLASS (bamf_tab_parent_class)->constructed (object);

  self = BAMF_TAB (object);

  g_signal_connect (self->priv->source, "remote-tab-uri-changed",
                    G_CALLBACK (on_tab_source_uri_changed), self);
}

Here is the call graph for this function:

Here is the caller graph for this function:

char* bamf_tab_current_uri ( BamfTab *  self)

Definition at line 49 of file bamf-tab.c.

{
  g_return_val_if_fail (BAMF_IS_TAB (self), NULL);

  return g_strdup (self->priv->uri);
}
static void bamf_tab_dbus_iface_init ( BamfDBusItemTabIface *  iface) [static]

Definition at line 277 of file bamf-tab.c.

{
}
static void bamf_tab_dispose ( GObject *  object) [static]

Definition at line 218 of file bamf-tab.c.

{
  BamfTab *self = BAMF_TAB (object);

  if (self->priv->id)
    {
      g_free (self->priv->id);
      self->priv->id = NULL;
    }

  if (self->priv->uri)
    {
      g_free (self->priv->uri);
      self->priv->uri = NULL;
    }

  G_OBJECT_CLASS (bamf_tab_parent_class)->dispose (object);
}

Here is the caller graph for this function:

static void bamf_tab_finalize ( GObject *  object) [static]

Definition at line 238 of file bamf-tab.c.

{
  BamfTab *self = BAMF_TAB (object);

  g_object_unref (self->priv->dbus_iface);

  G_OBJECT_CLASS (bamf_tab_parent_class)->finalize (object);
}

Here is the caller graph for this function:

gchar* bamf_tab_get_preview ( BamfTab *  tab)

Definition at line 72 of file bamf-tab.c.

{
  return bamf_tab_source_get_tab_preview (tab->priv->source, tab->priv->id);
}

Here is the call graph for this function:

static void bamf_tab_get_property ( GObject *  object,
guint  property_id,
GValue *  value,
GParamSpec *  pspec 
) [static]

Definition at line 182 of file bamf-tab.c.

{
  BamfTab *self;

  self = BAMF_TAB (object);

  switch (property_id)
    {
      case PROP_ID:
        g_value_set_string (value, self->priv->id);
        break;

      case PROP_SOURCE:
        g_value_set_object (value, self->priv->source);
        break;

      default:
        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
    }
}

Here is the caller graph for this function:

static const char* bamf_tab_get_view_type ( BamfView *  view) [static]

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

{
  return "tab";
}

Here is the caller graph for this function:

static void bamf_tab_init ( BamfTab *  self) [static]

Definition at line 248 of file bamf-tab.c.

{
  self->priv = BAMF_TAB_GET_PRIVATE (self);

  /* Initializing the dbus interface */
  self->priv->dbus_iface = bamf_dbus_item_tab_skeleton_new ();

  /* We need to connect to the object own signals to redirect them to the dbus
   * interface                                                                */
  g_signal_connect (self, "uri-changed", G_CALLBACK (on_uri_changed), NULL);

  /* Registering signal callbacks to reply to dbus method calls */
  g_signal_connect (self->priv->dbus_iface, "handle-show-tab",
                    G_CALLBACK (on_dbus_handle_show_tab), self);

  g_signal_connect (self->priv->dbus_iface, "handle-parent-xid",
                    G_CALLBACK (on_dbus_handle_parent_xid), self);

  g_signal_connect (self->priv->dbus_iface, "handle-current-uri",
                    G_CALLBACK (on_dbus_handle_current_uri), self);

  g_signal_connect (self->priv->dbus_iface, "handle-preview",
                    G_CALLBACK (on_dbus_handle_preview), self);

  /* Setting the interface for the dbus object */
  bamf_dbus_item_object_skeleton_set_tab (BAMF_DBUS_ITEM_OBJECT_SKELETON (self),
                                          self->priv->dbus_iface);
}

Here is the call graph for this function:

BamfTab* bamf_tab_new ( BamfTabSource *  source,
const char *  id 
)

Definition at line 305 of file bamf-tab.c.

{
  BamfTab *self;
  self = (BamfTab *) g_object_new (BAMF_TYPE_TAB,
                                   "source", source,
                                   "id", id,
                                   NULL);

  return self;
}
guint32 bamf_tab_parent_xid ( BamfTab *  tab)

Definition at line 64 of file bamf-tab.c.

{
  g_return_val_if_fail (BAMF_IS_TAB (tab), 0);

  return bamf_tab_source_get_tab_xid (tab->priv->source, tab->priv->id);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void bamf_tab_set_property ( GObject *  object,
guint  property_id,
const GValue *  value,
GParamSpec *  pspec 
) [static]

Definition at line 160 of file bamf-tab.c.

{
  BamfTab *self;

  self = BAMF_TAB (object);

  switch (property_id)
    {
      case PROP_ID:
        self->priv->id = g_value_dup_string (value);
        break;

      case PROP_SOURCE:
        self->priv->source = g_value_get_object (value);
        break;

      default:
        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
    }
}

Here is the caller graph for this function:

void bamf_tab_show ( BamfTab *  tab)

Definition at line 57 of file bamf-tab.c.

{
  g_return_if_fail (BAMF_IS_TAB (tab));

  bamf_tab_source_show_tab (tab->priv->source, tab->priv->id);
}

Here is the call graph for this function:

G_DEFINE_TYPE_WITH_CODE ( BamfTab  ,
bamf_tab  ,
BAMF_TYPE_VIEW  ,
G_IMPLEMENT_INTERFACE(BAMF_DBUS_ITEM_TYPE_TAB, bamf_tab_dbus_iface_init  
)
static gboolean on_dbus_handle_current_uri ( BamfDBusItemTab *  interface,
GDBusMethodInvocation *  invocation,
BamfTab *  self 
) [static]

Definition at line 127 of file bamf-tab.c.

{
  char *current_uri = self->priv->uri ? self->priv->uri : "";
  g_dbus_method_invocation_return_value (invocation,
                                         g_variant_new ("(s)", current_uri));

  return TRUE;
}

Here is the caller graph for this function:

static gboolean on_dbus_handle_parent_xid ( BamfDBusItemTab *  interface,
GDBusMethodInvocation *  invocation,
BamfTab *  self 
) [static]

Definition at line 115 of file bamf-tab.c.

{
  guint32 parent_xid = bamf_tab_parent_xid (self);
  g_dbus_method_invocation_return_value (invocation,
                                         g_variant_new ("(u)", parent_xid));

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static gboolean on_dbus_handle_preview ( BamfDBusItemTab *  interface,
GDBusMethodInvocation *  invocation,
BamfTab *  self 
) [static]

Definition at line 139 of file bamf-tab.c.

{
  gchar *preview = bamf_tab_get_preview (self);

  if (preview)
    {
      bamf_dbus_item_tab_complete_preview (interface, invocation, preview);
      g_free (preview);
    }
  else
    {
      g_dbus_method_invocation_return_value (invocation,
                                             g_variant_new ("(ay)", NULL));
    }

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static gboolean on_dbus_handle_show_tab ( BamfDBusItemTab *  interface,
GDBusMethodInvocation *  invocation,
BamfTab *  self 
) [static]

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

{
  bamf_tab_show (self);
  g_dbus_method_invocation_return_value (invocation, NULL);

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void on_tab_source_uri_changed ( BamfTabSource *  source,
char *  id,
char *  old_uri,
char *  new_uri,
BamfTab *  self 
) [static]

Definition at line 84 of file bamf-tab.c.

{
  if (g_strcmp0 (id, self->priv->id) != 0)
    return;

  g_free (self->priv->uri);
  self->priv->uri = g_strdup (new_uri);

  g_signal_emit_by_name (self, "uri-changed", old_uri, new_uri);
}

Here is the caller graph for this function:

static void on_uri_changed ( BamfTab *  self,
const gchar *  old_uri,
const gchar *  new_uri,
gpointer  _not_used 
) [static]

Definition at line 97 of file bamf-tab.c.

{
  g_return_if_fail (BAMF_IS_TAB (self));
  g_signal_emit_by_name (self->priv->dbus_iface, "uri-changed", old_uri, new_uri);
}

Here is the caller graph for this function: