Back to index

bamf  0.2.120
Classes | Defines | Typedefs | Functions
bamf-application.h File Reference
#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  _BamfApplication
struct  _BamfApplicationClass

Defines

#define BAMF_TYPE_APPLICATION   (bamf_application_get_type ())
#define BAMF_APPLICATION(obj)
#define BAMF_APPLICATION_CLASS(klass)
#define BAMF_IS_APPLICATION(obj)
#define BAMF_IS_APPLICATION_CLASS(klass)
#define BAMF_APPLICATION_GET_CLASS(obj)

Typedefs

typedef struct _BamfApplication
typedef struct _BamfApplicationClass
typedef struct _BamfApplicationPrivate

Functions

GType bamf_application_get_type (void) G_GNUC_CONST
const gchar * bamf_application_get_application_type (BamfApplication *application)
 bamf_application_get_applicaton_type: : a #BamfApplication
const gchar * bamf_application_get_desktop_file (BamfApplication *application)
 bamf_application_get_desktop_file: : a #BamfApplication
GList * bamf_application_get_windows (BamfApplication *application)
 bamf_application_get_windows: : a #BamfApplication
GArray * bamf_application_get_xids (BamfApplication *application)
 bamf_application_get_xids: : a #BamfApplication
gboolean bamf_application_get_show_menu_stubs (BamfApplication *application)
 bamf_application_get_show_stubs: : a #BamfApplication

Class Documentation

struct _BamfApplication

Definition at line 56 of file bamf-application.h.

Class Members
BamfView parent
BamfApplicationPrivate * priv

Define Documentation

#define BAMF_APPLICATION (   obj)
Value:
(G_TYPE_CHECK_INSTANCE_CAST ((obj),\
        BAMF_TYPE_APPLICATION, BamfApplication))

Definition at line 37 of file bamf-application.h.

#define BAMF_APPLICATION_CLASS (   klass)
Value:
(G_TYPE_CHECK_CLASS_CAST ((klass),\
        BAMF_TYPE_APPLICATION, BamfApplicationClass))

Definition at line 40 of file bamf-application.h.

#define BAMF_APPLICATION_GET_CLASS (   obj)
Value:
(G_TYPE_INSTANCE_GET_CLASS ((obj),\
        BAMF_TYPE_APPLICATION, BamfApplicationClass))

Definition at line 49 of file bamf-application.h.

#define BAMF_IS_APPLICATION (   obj)
Value:
(G_TYPE_CHECK_INSTANCE_TYPE ((obj),\
        BAMF_TYPE_APPLICATION))

Definition at line 43 of file bamf-application.h.

#define BAMF_IS_APPLICATION_CLASS (   klass)
Value:
(G_TYPE_CHECK_CLASS_TYPE ((klass),\
        BAMF_TYPE_APPLICATION))

Definition at line 46 of file bamf-application.h.

Definition at line 35 of file bamf-application.h.


Typedef Documentation

typedef struct _BamfApplication

Definition at line 52 of file bamf-application.h.

typedef struct _BamfApplicationClass

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

typedef struct _BamfApplicationPrivate

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


Function Documentation

const gchar* bamf_application_get_application_type ( BamfApplication *  application)

bamf_application_get_applicaton_type: : a #BamfApplication

Used to determine what type of application a .desktop file represents. Current values are: "system" : A normal application, like firefox or evolution "web" : A web application, like facebook or twitter

Returns: A string

Definition at line 114 of file bamf-application.c.

{
  BamfApplicationPrivate *priv;
  gchar *type;
  GError *error = NULL;

  g_return_val_if_fail (BAMF_IS_APPLICATION (application), FALSE);
  priv = application->priv;

  if (priv->application_type)
    return priv->application_type;

  if (!_bamf_view_remote_ready (BAMF_VIEW (application)))
    return NULL;

  if (!dbus_g_proxy_call (priv->proxy,
                          "ApplicationType",
                          &error,
                          G_TYPE_INVALID,
                          G_TYPE_STRING, &type,
                          G_TYPE_INVALID))
    {
      g_warning ("Failed to fetch path: %s", error->message);
      g_error_free (error);

      return NULL;
    }

  priv->application_type = type;
  return type;
}

Here is the call graph for this function:

const gchar* bamf_application_get_desktop_file ( BamfApplication *  application)

bamf_application_get_desktop_file: : a #BamfApplication

Used to fetch the path to the .desktop file associated with the passed application. If none exists, the result is NULL.

Returns: A string representing the path to the desktop file.

Definition at line 75 of file bamf-application.c.

{
  BamfApplicationPrivate *priv;
  gchar *file;
  GError *error = NULL;

  g_return_val_if_fail (BAMF_IS_APPLICATION (application), FALSE);
  priv = application->priv;

  if (priv->desktop_file)
    return priv->desktop_file;

  if (!_bamf_view_remote_ready (BAMF_VIEW (application)))
    return NULL;

  if (!dbus_g_proxy_call (priv->proxy,
                          "DesktopFile",
                          &error,
                          G_TYPE_INVALID,
                          G_TYPE_STRING, &file,
                          G_TYPE_INVALID))
    {
      g_warning ("Failed to fetch path: %s", error->message);
      g_error_free (error);

      return NULL;
    }

  if (file && file[0] == '\0')
    {
      g_free (file);
      file = NULL;
    }

  priv->desktop_file = file;
  return file;
}
gboolean bamf_application_get_show_menu_stubs ( BamfApplication *  application)

bamf_application_get_show_stubs: : a #BamfApplication

Used to discover whether the application wants menu stubs shown.

Returns: Whether the stubs should be shown.

Definition at line 201 of file bamf-application.c.

{
  BamfApplicationPrivate *priv;
  GError *error = NULL;
  gboolean result;

  g_return_val_if_fail (BAMF_IS_APPLICATION (application), TRUE);

  priv = application->priv;

  if (!_bamf_view_remote_ready (BAMF_VIEW (application)))
    return TRUE;

  if (priv->show_stubs == -1)
    {
      if (!dbus_g_proxy_call (application->priv->proxy,
                              "ShowStubs",
                              &error,
                              G_TYPE_INVALID,
                              G_TYPE_BOOLEAN, &result,
                              G_TYPE_INVALID))
        {
          g_warning ("Failed to fetch show_stubs: %s", error->message);
          g_error_free (error);

          return TRUE;
        }

      if (result)
        priv->show_stubs = 1;
      else
        priv->show_stubs = 0;
    }

  return priv->show_stubs;
}

Here is the call graph for this function:

GType bamf_application_get_type ( void  )
GList* bamf_application_get_windows ( BamfApplication *  application)

bamf_application_get_windows: : a #BamfApplication

Used to fetch all #BamfWindow's associated with the passed #BamfApplication.

Returns: (element-type Bamf.Window) (transfer container): A list of #BamfWindow's.

Definition at line 176 of file bamf-application.c.

{
  GList *children, *l;
  GList *windows = NULL;
  BamfView *view;

  g_return_val_if_fail (BAMF_IS_APPLICATION (application), NULL);

  children = bamf_view_get_children (BAMF_VIEW (application));

  for (l = children; l; l = l->next)
    {
      view = l->data;

      if (BAMF_IS_WINDOW (view));
        {
          windows = g_list_prepend (windows, view);
        }
    }

  g_list_free (children);
  return windows;
}

Here is the call graph for this function:

GArray* bamf_application_get_xids ( BamfApplication *  application)

bamf_application_get_xids: : a #BamfApplication

Used to fetch all #BamfWindow's xids associated with the passed #BamfApplication.

Returns: (transfer full): An array of xids.

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

{
  BamfApplicationPrivate *priv;
  GArray *xids;
  GError *error = NULL;

  g_return_val_if_fail (BAMF_IS_APPLICATION (application), FALSE);
  priv = application->priv;

  if (!_bamf_view_remote_ready (BAMF_VIEW (application)))
    return NULL;

  if (!dbus_g_proxy_call (priv->proxy,
                          "Xids",
                          &error,
                          G_TYPE_INVALID,
                          DBUS_TYPE_G_UINT_ARRAY, &xids,
                          G_TYPE_INVALID))
    {
      g_warning ("Failed to fetch xids: %s", error->message);
      g_error_free (error);

      return NULL;
    }

  return xids;
}