Back to index

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

Go to the source code of this file.

Classes

struct  _BamfApplicationClass
struct  _BamfApplication

Defines

#define BAMF_TYPE_APPLICATION   (bamf_application_get_type ())
#define BAMF_APPLICATION(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), BAMF_TYPE_APPLICATION, BamfApplication))
#define BAMF_IS_APPLICATION(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BAMF_TYPE_APPLICATION))
#define BAMF_APPLICATION_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), BAMF_TYPE_APPLICATION, BamfApplicationClass))
#define BAMF_IS_APPLICATION_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), BAMF_TYPE_APPLICATION))
#define BAMF_APPLICATION_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), BAMF_TYPE_APPLICATION, BamfApplicationClass))

Typedefs

typedef struct _BamfApplication
typedef struct _BamfApplicationClass
typedef struct _BamfApplicationPrivate

Functions

GType bamf_application_get_type (void) G_GNUC_CONST
const char * bamf_application_get_desktop_file (BamfApplication *application)
 bamf_application_get_desktop_file: : a #BamfApplication
void bamf_application_set_desktop_file (BamfApplication *application, const char *desktop_file)
GVariant * bamf_application_get_xids (BamfApplication *application)
 bamf_application_get_xids: : a #BamfApplication
gboolean bamf_application_manages_xid (BamfApplication *application, guint32 xid)
gboolean bamf_application_contains_similar_to_window (BamfApplication *app, BamfWindow *window)
const char * bamf_application_get_wmclass (BamfApplication *application)
void bamf_application_set_wmclass (BamfApplication *application, const char *wmclass)
BamfApplication * bamf_application_new (void)
BamfApplication * bamf_application_new_from_desktop_file (const char *desktop_file)
gboolean bamf_application_get_show_stubs (BamfApplication *application)
 bamf_application_get_show_stubs: : Application to check for menu stubs
BamfApplication * bamf_application_new_from_desktop_files (GList *desktop_files)
BamfApplication * bamf_application_new_with_wmclass (const char *wmclass)

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)    (G_TYPE_CHECK_INSTANCE_CAST ((obj), BAMF_TYPE_APPLICATION, BamfApplication))

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

#define BAMF_APPLICATION_CLASS (   klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), BAMF_TYPE_APPLICATION, BamfApplicationClass))

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

#define BAMF_APPLICATION_GET_CLASS (   obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), BAMF_TYPE_APPLICATION, BamfApplicationClass))

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

#define BAMF_IS_APPLICATION (   obj)    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), BAMF_TYPE_APPLICATION))

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

#define BAMF_IS_APPLICATION_CLASS (   klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), BAMF_TYPE_APPLICATION))

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

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


Typedef Documentation

typedef struct _BamfApplication

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

typedef struct _BamfApplicationClass

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

typedef struct _BamfApplicationPrivate

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


Function Documentation

gboolean bamf_application_contains_similar_to_window ( BamfApplication *  app,
BamfWindow *  window 
)

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

{
  GList *children, *l;
  BamfView *child;

  g_return_val_if_fail (BAMF_IS_APPLICATION (self), FALSE);
  g_return_val_if_fail (BAMF_IS_WINDOW (bamf_window), FALSE);

  BamfLegacyWindow *window = bamf_window_get_window (bamf_window);
  const char *window_class = bamf_legacy_window_get_class_name (window);
  const char *instance_name = bamf_legacy_window_get_class_instance_name (window);

  if (!window_class || !instance_name)
    return FALSE;

  children = bamf_view_get_children (BAMF_VIEW (self));
  for (l = children; l; l = l->next)
    {
      child = l->data;

      if (!BAMF_IS_WINDOW (child))
        continue;

      window = bamf_window_get_window (BAMF_WINDOW (child));
      const char *owned_win_class = bamf_legacy_window_get_class_name (window);
      const char *owned_instance = bamf_legacy_window_get_class_instance_name (window);

      if (g_strcmp0 (window_class, owned_win_class) == 0 &&
          g_strcmp0 (instance_name, owned_instance) == 0)
        {
          return TRUE;
        }
    }

  return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

const char* 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;
}

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean bamf_application_get_show_stubs ( BamfApplication *  application)

bamf_application_get_show_stubs: : Application to check for menu stubs

Checks to see if the application should show menu stubs or not. This is specified with the "X-Ayatana-Appmenu-Show-Stubs" desktop file key.

Return Value: Defaults to TRUE, else FALSE if specified in .desktop file.

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

{
    g_return_val_if_fail(BAMF_IS_APPLICATION(application), TRUE);
    return application->priv->show_stubs;
}

Here is the caller graph for this function:

GType bamf_application_get_type ( void  )
const char* bamf_application_get_wmclass ( BamfApplication *  application)

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

{
  BamfApplicationPrivate *priv;

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

  return priv->wmclass;
}

Here is the caller graph for this function:

GVariant* 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;
}

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean bamf_application_manages_xid ( BamfApplication *  application,
guint32  xid 
)

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

{
  GList *l;
  gboolean result = FALSE;

  g_return_val_if_fail (BAMF_IS_APPLICATION (application), FALSE);

  for (l = bamf_view_get_children (BAMF_VIEW (application)); l; l = l->next)
    {
      BamfView *view = l->data;

      if (!BAMF_IS_WINDOW (view))
        continue;

      if (bamf_window_get_xid (BAMF_WINDOW (view)) == xid)
        {
          result = TRUE;
          break;
        }
    }

  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

BamfApplication* bamf_application_new ( void  )

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

{
  BamfApplication *application;
  application = (BamfApplication *) g_object_new (BAMF_TYPE_APPLICATION, NULL);

  return application;
}
BamfApplication* bamf_application_new_from_desktop_file ( const char *  desktop_file)

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

{
  BamfApplication *application;
  application = (BamfApplication *) g_object_new (BAMF_TYPE_APPLICATION, NULL);

  bamf_application_set_desktop_file (application, desktop_file);

  return application;
}

Here is the call graph for this function:

Here is the caller graph for this function:

BamfApplication* bamf_application_new_from_desktop_files ( GList *  desktop_files)

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

{
  BamfApplication *application;
  application = (BamfApplication *) g_object_new (BAMF_TYPE_APPLICATION, NULL);
  
  bamf_application_set_desktop_file_from_list (application, desktop_files);
  
  return application;  
}

Here is the call graph for this function:

Here is the caller graph for this function:

BamfApplication* bamf_application_new_with_wmclass ( const char *  wmclass)

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

{
  BamfApplication *application;
  application = (BamfApplication *) g_object_new (BAMF_TYPE_APPLICATION, NULL);

  bamf_application_set_wmclass (application, wmclass);

  return application;
}

Here is the call graph for this function:

void bamf_application_set_desktop_file ( BamfApplication *  application,
const char *  desktop_file 
)

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

{
  g_return_if_fail (BAMF_IS_APPLICATION (application));

  if (application->priv->desktop_file)
    g_free (application->priv->desktop_file);

  if (desktop_file && desktop_file[0] != '\0')
    application->priv->desktop_file = g_strdup (desktop_file);
  else
    application->priv->desktop_file = NULL;

  bamf_application_setup_icon_and_name (application);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void bamf_application_set_wmclass ( BamfApplication *  application,
const char *  wmclass 
)

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

{
  g_return_if_fail (BAMF_IS_APPLICATION (application));

  if (application->priv->wmclass)
    g_free (application->priv->wmclass);

  if (wmclass && wmclass[0] != '\0')
    application->priv->wmclass = g_strdup (wmclass);
  else
    application->priv->wmclass = NULL;
}

Here is the caller graph for this function: