Back to index

bamf  0.2.120
Classes | Defines | Enumerations | Functions | Variables
bamf-matcher.c File Reference
#include "bamf-matcher.h"
#include "bamf-view.h"
#include "bamf-view-private.h"
#include "bamf-factory.h"
#include "bamf-marshal.h"
#include <string.h>
#include <dbus/dbus.h>
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>

Go to the source code of this file.

Classes

struct  _BamfMatcherPrivate

Defines

#define BAMF_MATCHER_GET_PRIVATE(o)   (G_TYPE_INSTANCE_GET_PRIVATE ((o), BAMF_TYPE_MATCHER, BamfMatcherPrivate))

Enumerations

enum  {
  VIEW_OPENED, VIEW_CLOSED, ACTIVE_APPLICATION_CHANGED, ACTIVE_WINDOW_CHANGED,
  STACKING_ORDER_CHANGED, LAST_SIGNAL
}

Functions

 G_DEFINE_TYPE (BamfMatcher, bamf_matcher, G_TYPE_OBJECT)
 SECTION:bamf-matcher : The base class for all matchers.
static void bamf_matcher_dispose (GObject *object)
static void bamf_matcher_finalize (GObject *object)
static void bamf_matcher_class_init (BamfMatcherClass *klass)
static void bamf_matcher_on_view_opened (DBusGProxy *proxy, char *path, char *type, BamfMatcher *matcher)
static void bamf_matcher_on_view_closed (DBusGProxy *proxy, char *path, char *type, BamfMatcher *matcher)
static void bamf_matcher_on_active_application_changed (DBusGProxy *proxy, char *old_path, char *new_path, BamfMatcher *matcher)
static void bamf_matcher_on_active_window_changed (DBusGProxy *proxy, char *old_path, char *new_path, BamfMatcher *matcher)
static void bamf_matcher_on_stacking_order_changed (DBusGProxy *proxy, BamfMatcher *matcher)
static void bamf_matcher_init (BamfMatcher *self)
BamfMatcher * bamf_matcher_get_default (void)
 bamf_matcher_get_default: : a #BamfMatcher
BamfApplication * bamf_matcher_get_active_application (BamfMatcher *matcher)
 bamf_matcher_get_active_application: : a #BamfMatcher
BamfWindow * bamf_matcher_get_active_window (BamfMatcher *matcher)
 bamf_matcher_get_active_window: : a #BamfMatcher
BamfApplication * bamf_matcher_get_application_for_window (BamfMatcher *matcher, BamfWindow *window)
 bamf_matcher_get_application_for_window: : a #BamfMatcher : The window to look for
BamfApplication * bamf_matcher_get_application_for_xid (BamfMatcher *matcher, guint32 xid)
 bamf_matcher_get_application_for_xid: : a #BamfMatcher : The XID to search for
gboolean bamf_matcher_application_is_running (BamfMatcher *matcher, const gchar *application)
GList * bamf_matcher_get_applications (BamfMatcher *matcher)
 bamf_matcher_get_applications: : a #BamfMatcher
GList * bamf_matcher_get_windows (BamfMatcher *matcher)
 bamf_matcher_get_windows: : a #BamfMatcher
GList * bamf_matcher_get_window_stack_for_monitor (BamfMatcher *matcher, gint monitor)
 bamf_matcher_get_window_stack_for_monitor: : a #BamfMatcher : the monitor you want the stack from, negative value to get all
void bamf_matcher_register_favorites (BamfMatcher *matcher, const gchar **favorites)
 bamf_matcher_register_favorites: : a #BamfMatcher : an array of strings, each containing an absolute path to a .desktop file
GList * bamf_matcher_get_running_applications (BamfMatcher *matcher)
 bamf_matcher_get_running_applications: : a #BamfMatcher
GList * bamf_matcher_get_tabs (BamfMatcher *matcher)
 bamf_matcher_get_tabs: : a #BamfMatcher
GArray * bamf_matcher_get_xids_for_application (BamfMatcher *matcher, const gchar *application)
 bamf_matcher_get_applications: : a #BamfMatcher
BamfApplication * bamf_matcher_get_application_for_desktop_file (BamfMatcher *matcher, const gchar *desktop_file_path, gboolean create_if_not_found)

Variables

static guint matcher_signals [LAST_SIGNAL] = { 0 }
static BamfMatcher * default_matcher = NULL

Class Documentation

struct _BamfMatcherPrivate

Definition at line 66 of file bamf-matcher.c.

Class Members
BamfView * active_app
BamfView * active_win
GArray * bad_prefixes
DBusGConnection * connection
GHashTable * desktop_class_table
GHashTable * desktop_file_table
GHashTable * desktop_id_table
guint dispatch_changes_id
GList * favorites
GArray * good_prefixes
GArray * known_pids
GList * monitors
GHashTable * opened_closed_paths_table
DBusGProxy * proxy
GHashTable * registered_pids
GList * views

Define Documentation

#define BAMF_MATCHER_GET_PRIVATE (   o)    (G_TYPE_INSTANCE_GET_PRIVATE ((o), BAMF_TYPE_MATCHER, BamfMatcherPrivate))

Definition at line 50 of file bamf-matcher.c.


Enumeration Type Documentation

anonymous enum
Enumerator:
VIEW_OPENED 
VIEW_CLOSED 
ACTIVE_APPLICATION_CHANGED 
ACTIVE_WINDOW_CHANGED 
STACKING_ORDER_CHANGED 
LAST_SIGNAL 

Definition at line 53 of file bamf-matcher.c.


Function Documentation

gboolean bamf_matcher_application_is_running ( BamfMatcher *  matcher,
const gchar *  application 
)

Definition at line 498 of file bamf-matcher.c.

{
  BamfMatcherPrivate *priv;
  gboolean running = FALSE;
  GError *error = NULL;

  g_return_val_if_fail (BAMF_IS_MATCHER (matcher), FALSE);
  priv = matcher->priv;

  if (!dbus_g_proxy_call (priv->proxy,
                          "ApplicationIsRunning",
                          &error,
                          G_TYPE_STRING, application,
                          G_TYPE_INVALID,
                          G_TYPE_BOOLEAN, &running,
                          G_TYPE_INVALID))
    {
      g_warning ("Failed to fetch path: %s", error->message);
      g_error_free (error);
      
      return FALSE;
    }

  return running;
}

Here is the caller graph for this function:

static void bamf_matcher_class_init ( BamfMatcherClass *  klass) [static]

Definition at line 85 of file bamf-matcher.c.

{
  GObjectClass *obj_class = G_OBJECT_CLASS (klass);

  g_type_class_add_private (obj_class, sizeof (BamfMatcherPrivate));
  obj_class->dispose = bamf_matcher_dispose;
  obj_class->finalize = bamf_matcher_finalize;

  matcher_signals [VIEW_OPENED] = 
    g_signal_new ("view-opened",
                  G_OBJECT_CLASS_TYPE (klass),
                  0,
                  0, NULL, NULL,
                  g_cclosure_marshal_VOID__OBJECT,
                  G_TYPE_NONE, 1, 
                  G_TYPE_OBJECT);

  matcher_signals [VIEW_CLOSED] = 
    g_signal_new ("view-closed",
                  G_OBJECT_CLASS_TYPE (klass),
                  0,
                  0, NULL, NULL,
                  g_cclosure_marshal_VOID__OBJECT,
                  G_TYPE_NONE, 1, 
                  G_TYPE_OBJECT);


  matcher_signals [ACTIVE_APPLICATION_CHANGED] = 
    g_signal_new ("active-application-changed",
                  G_OBJECT_CLASS_TYPE (klass),
                  0,
                  0, NULL, NULL,
                  _bamf_marshal_VOID__OBJECT_OBJECT,
                  G_TYPE_NONE, 2, 
                  G_TYPE_OBJECT, G_TYPE_OBJECT);

  matcher_signals [ACTIVE_WINDOW_CHANGED] = 
    g_signal_new ("active-window-changed",
                  G_OBJECT_CLASS_TYPE (klass),
                  0,
                  0, NULL, NULL,
                  _bamf_marshal_VOID__OBJECT_OBJECT,
                  G_TYPE_NONE, 2, 
                  G_TYPE_OBJECT, G_TYPE_OBJECT);

  matcher_signals [STACKING_ORDER_CHANGED] = 
    g_signal_new ("stacking-order-changed",
                  G_OBJECT_CLASS_TYPE (klass),
                  0,
                  0, NULL, NULL,
                  g_cclosure_marshal_VOID__VOID,
                  G_TYPE_NONE, 0);
}

Here is the call graph for this function:

static void bamf_matcher_dispose ( GObject *  object) [static]

Definition at line 303 of file bamf-matcher.c.

{
  BamfMatcher *self = BAMF_MATCHER (object);
  BamfMatcherPrivate *priv = self->priv;

  if (priv->proxy)
    {
      dbus_g_proxy_disconnect_signal (priv->proxy,
                                      "ViewOpened",
                                      (GCallback) bamf_matcher_on_view_opened,
                                      self);

      dbus_g_proxy_disconnect_signal (priv->proxy,
                                      "ViewClosed",
                                      (GCallback) bamf_matcher_on_view_closed,
                                      self);

      dbus_g_proxy_disconnect_signal (priv->proxy,
                                      "ActiveApplicationChanged",
                                      (GCallback) bamf_matcher_on_active_application_changed,
                                      self);

      dbus_g_proxy_disconnect_signal (priv->proxy,
                                      "ActiveWindowChanged",
                                      (GCallback) bamf_matcher_on_active_window_changed,
                                      self);

      dbus_g_proxy_disconnect_signal (priv->proxy,
                                      "StackingOrderChanged",
                                      (GCallback) bamf_matcher_on_stacking_order_changed,
                                      self);

      g_object_unref (priv->proxy);
      priv->proxy = NULL;
    }

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

Here is the call graph for this function:

Here is the caller graph for this function:

static void bamf_matcher_finalize ( GObject *  object) [static]

Definition at line 77 of file bamf-matcher.c.

{
  default_matcher = NULL;

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

Here is the caller graph for this function:

BamfApplication* bamf_matcher_get_active_application ( BamfMatcher *  matcher)

bamf_matcher_get_active_application: : a #BamfMatcher

Used to fetch the active #BamfApplication.

Returns: (transfer none): The active #BamfApplication.

Definition at line 359 of file bamf-matcher.c.

{
  BamfMatcherPrivate *priv;
  BamfView *view;
  char *app = NULL;
  GError *error = NULL;

  g_return_val_if_fail (BAMF_IS_MATCHER (matcher), NULL);
  priv = matcher->priv;

  if (!dbus_g_proxy_call (priv->proxy,
                          "ActiveApplication",
                          &error,
                          G_TYPE_INVALID,
                          G_TYPE_STRING, &app,
                          G_TYPE_INVALID))
    {
      g_warning ("Failed to fetch path: %s", error->message);
      g_error_free (error);
      return NULL;
    }

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

  if (!app)
    return NULL;

  BamfFactory *factory = _bamf_factory_get_default ();
  view = _bamf_factory_view_for_path_type (factory, app, BAMF_FACTORY_APPLICATION);
  g_free (app);

  if (!BAMF_IS_APPLICATION (view))
    return NULL;

  return BAMF_APPLICATION (view);
}

Here is the caller graph for this function:

BamfWindow* bamf_matcher_get_active_window ( BamfMatcher *  matcher)

bamf_matcher_get_active_window: : a #BamfMatcher

Used to fetch the active #BamfWindow.

Returns: (transfer none): The active #BamfWindow.

Definition at line 401 of file bamf-matcher.c.

{
  BamfMatcherPrivate *priv;
  BamfView *view;
  char *win = NULL;
  GError *error = NULL;

  g_return_val_if_fail (BAMF_IS_MATCHER (matcher), NULL);
  priv = matcher->priv;

  if (!dbus_g_proxy_call (priv->proxy,
                          "ActiveWindow",
                          &error,
                          G_TYPE_INVALID,
                          G_TYPE_STRING, &win,
                          G_TYPE_INVALID))
    {
      g_warning ("Failed to fetch path: %s", error->message);
      g_error_free (error);
      return NULL;
    }

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

  if (!win)
    return NULL;

  BamfFactory *factory = _bamf_factory_get_default ();
  view = _bamf_factory_view_for_path_type (factory, win, BAMF_FACTORY_WINDOW);
  g_free (win);

  if (!BAMF_IS_WINDOW (view))
    return NULL;

  return BAMF_WINDOW (view);
}

Here is the caller graph for this function:

BamfApplication* bamf_matcher_get_application_for_desktop_file ( BamfMatcher *  matcher,
const gchar *  desktop_file_path,
gboolean  create_if_not_found 
)

Definition at line 732 of file bamf-matcher.c.

{
  BamfApplication *app;
  const gchar ** favs;
  
  app = _bamf_factory_app_for_file (_bamf_factory_get_default (), desktop_file_path, create_if_not_found);
  if (app)
    {
      favs = g_malloc0 (sizeof (gchar *) * 2),
      favs[0] = desktop_file_path;      
      bamf_matcher_register_favorites (matcher, favs);
      g_free (favs);
    }
  return app;
}

Here is the call graph for this function:

BamfApplication* bamf_matcher_get_application_for_window ( BamfMatcher *  matcher,
BamfWindow *  window 
)

bamf_matcher_get_application_for_window: : a #BamfMatcher : The window to look for

Used to fetch the #BamfApplication containing the passed window.

Returns: (transfer container): The #BamfApplication representing the xid passed, or NULL if none exists.

Definition at line 445 of file bamf-matcher.c.

Here is the call graph for this function:

Here is the caller graph for this function:

BamfApplication* bamf_matcher_get_application_for_xid ( BamfMatcher *  matcher,
guint32  xid 
)

bamf_matcher_get_application_for_xid: : a #BamfMatcher : The XID to search for

Used to fetch the #BamfApplication containing the passed xid.

Returns: (transfer container): The #BamfApplication representing the xid passed, or NULL if none exists.

Definition at line 453 of file bamf-matcher.c.

{
  BamfMatcherPrivate *priv;
  BamfView *view;
  char *app = NULL;
  GError *error = NULL;

  g_return_val_if_fail (BAMF_IS_MATCHER (matcher), NULL);
  priv = matcher->priv;

  if (!dbus_g_proxy_call (priv->proxy,
                          "ApplicationForXid",
                          &error,
                          G_TYPE_UINT, xid,
                          G_TYPE_INVALID,
                          G_TYPE_STRING, &app,
                          G_TYPE_INVALID))
    {
      g_warning ("Failed to fetch path: %s", error->message);
      g_error_free (error);
      return NULL;
    }

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

  if (!app)
    return NULL;

  BamfFactory *factory = _bamf_factory_get_default ();
  view = _bamf_factory_view_for_path_type (factory, app, BAMF_FACTORY_APPLICATION);
  
  g_free (app);

  if (!BAMF_IS_APPLICATION (view))
    return NULL;

  return BAMF_APPLICATION (view);
}

Here is the call graph for this function:

Here is the caller graph for this function:

GList* bamf_matcher_get_applications ( BamfMatcher *  matcher)

bamf_matcher_get_applications: : a #BamfMatcher

Used to fetch all #BamfApplication's running or not. Application authors who wish to only see running applications should use bamf_matcher_get_running_applications instead. The reason this method is needed is bamf will occasionally track applications which are not currently running for nefarious purposes.

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

Definition at line 526 of file bamf-matcher.c.

{
  BamfMatcherPrivate *priv;
  BamfView *view;
  char **array = NULL;
  int i, len;
  GList *result = NULL;
  GError *error = NULL;

  g_return_val_if_fail (BAMF_IS_MATCHER (matcher), NULL);
  priv = matcher->priv;

  if (!dbus_g_proxy_call (priv->proxy,
                          "ApplicationPaths",
                          &error,
                          G_TYPE_INVALID,
                          G_TYPE_STRV, &array,
                          G_TYPE_INVALID))
    {
      g_warning ("Failed to fetch paths: %s", error->message);
      g_error_free (error);
      
      return NULL;
    }

  if (!array)
    return NULL;

  BamfFactory *factory = _bamf_factory_get_default ();
  len = g_strv_length (array);
  for (i = len-1; i >= 0; i--)
    {
      view = _bamf_factory_view_for_path_type (factory, array[i], BAMF_FACTORY_APPLICATION);

      if (BAMF_IS_APPLICATION (view))
        result = g_list_prepend (result, view);
    }
  
  g_strfreev (array);
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

BamfMatcher* bamf_matcher_get_default ( void  )

bamf_matcher_get_default: : a #BamfMatcher

Returns the default matcher. This matcher is owned by bamf and shared between other callers.

Returns: (transfer none): A new #BamfMatcher

Definition at line 350 of file bamf-matcher.c.

{
  if (BAMF_IS_MATCHER (default_matcher))
    return g_object_ref (default_matcher);

  return (default_matcher = g_object_new (BAMF_TYPE_MATCHER, NULL));
}

Here is the caller graph for this function:

GList* bamf_matcher_get_running_applications ( BamfMatcher *  matcher)

bamf_matcher_get_running_applications: : a #BamfMatcher

Used to fetch all #BamfApplication's which are running.

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

Definition at line 674 of file bamf-matcher.c.

{
  BamfMatcherPrivate *priv;
  BamfView *view;
  char **array = NULL;
  int i, len;
  GList *result = NULL;
  GError *error = NULL;

  g_return_val_if_fail (BAMF_IS_MATCHER (matcher), NULL);
  priv = matcher->priv;

  if (!dbus_g_proxy_call (priv->proxy,
                          "RunningApplications",
                          &error,
                          G_TYPE_INVALID,
                          G_TYPE_STRV, &array,
                          G_TYPE_INVALID))
    {
      g_warning ("Failed to fetch paths: %s", error->message);
      g_error_free (error);
      
      return NULL;
    }

  if (!array)
    return NULL;

  BamfFactory *factory = _bamf_factory_get_default ();
  len = g_strv_length (array);
  for (i = len-1; i >= 0; i--)
    {
      view = _bamf_factory_view_for_path_type (factory, array[i], BAMF_FACTORY_APPLICATION);

      if (BAMF_IS_APPLICATION (view))
        result = g_list_prepend (result, view);
    }

  g_strfreev (array);
  return result;
}

Here is the call graph for this function:

GList* bamf_matcher_get_tabs ( BamfMatcher *  matcher)

bamf_matcher_get_tabs: : a #BamfMatcher

Used to fetch all #BamfView's representing tabs. Currently unused.

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

Definition at line 717 of file bamf-matcher.c.

{
  /* FIXME */
  return NULL;
}
GList* bamf_matcher_get_window_stack_for_monitor ( BamfMatcher *  matcher,
gint  monitor 
)

bamf_matcher_get_window_stack_for_monitor: : a #BamfMatcher : the monitor you want the stack from, negative value to get all

Used to fetch all windows that BAMF knows about in the requested screen, in stacking bottom-to-top order.

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

Definition at line 612 of file bamf-matcher.c.

{
  BamfMatcherPrivate *priv;
  BamfView *view;
  char **array = NULL;
  int i, len;
  GList *result = NULL;
  GError *error = NULL;

  g_return_val_if_fail (BAMF_IS_MATCHER (matcher), NULL);
  priv = matcher->priv;

  if (!dbus_g_proxy_call (priv->proxy,
                          "WindowStackForMonitor",
                          &error,
                          G_TYPE_INT,
                          monitor,
                          G_TYPE_INVALID,
                          G_TYPE_STRV, &array,
                          G_TYPE_INVALID))
    {
      g_warning ("Failed to fetch paths: %s", error->message);
      g_error_free (error);
      
      return NULL;
    }

  if (!array)
    return NULL;

  BamfFactory *factory = _bamf_factory_get_default ();
  len = g_strv_length (array);
  for (i = len-1; i >= 0; i--)
    {
      view = _bamf_factory_view_for_path_type (factory, array[i], BAMF_FACTORY_WINDOW);

      if (BAMF_IS_WINDOW (view))
        result = g_list_prepend (result, view);
    }
  
  g_strfreev (array);
  return result;
}

Here is the caller graph for this function:

GList* bamf_matcher_get_windows ( BamfMatcher *  matcher)

bamf_matcher_get_windows: : a #BamfMatcher

Used to fetch all windows that BAMF knows about.

Returns: (element-type Bamf.View) (transfer container): A list of windows.

Definition at line 569 of file bamf-matcher.c.

{
  BamfMatcherPrivate *priv;
  BamfView *view;
  char **array = NULL;
  int i, len;
  GList *result = NULL;
  GError *error = NULL;

  g_return_val_if_fail (BAMF_IS_MATCHER (matcher), NULL);
  priv = matcher->priv;

  if (!dbus_g_proxy_call (priv->proxy,
                          "WindowPaths",
                          &error,
                          G_TYPE_INVALID,
                          G_TYPE_STRV, &array,
                          G_TYPE_INVALID))
    {
      g_warning ("Failed to fetch paths: %s", error->message);
      g_error_free (error);
      
      return NULL;
    }

  if (!array)
    return NULL;

  BamfFactory *factory = _bamf_factory_get_default ();
  len = g_strv_length (array);
  for (i = len-1; i >= 0; i--)
    {
      view = _bamf_factory_view_for_path_type (factory, array[i], BAMF_FACTORY_WINDOW);

      if (BAMF_IS_WINDOW (view))
        result = g_list_prepend (result, view);
    }
  
  g_strfreev (array);
  return result;
}

Here is the call graph for this function:

GArray* bamf_matcher_get_xids_for_application ( BamfMatcher *  matcher,
const gchar *  application 
)

bamf_matcher_get_applications: : a #BamfMatcher

Used to fetch all xid's associated with an application. Useful for performing window

Returns: (element-type guint32) (transfer none): A list of xids.

Definition at line 724 of file bamf-matcher.c.

{
  /* FIXME */
  return NULL;
}
static void bamf_matcher_init ( BamfMatcher *  self) [static]

Definition at line 217 of file bamf-matcher.c.

{
  BamfMatcherPrivate *priv;
  GError           *error = NULL;

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

  priv->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
  if (priv->connection == NULL || error != NULL)
    {
      g_error ("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/matcher",
                                           "org.ayatana.bamf.matcher");
  if (priv->proxy == NULL)
    {
      g_error ("Unable to get org.ayatana.bamf.matcher matcher");
    }

  dbus_g_object_register_marshaller ((GClosureMarshal) _bamf_marshal_VOID__STRING_STRING,
                                     G_TYPE_NONE, 
                                     G_TYPE_STRING, G_TYPE_STRING,
                                     G_TYPE_INVALID);

  dbus_g_proxy_add_signal (priv->proxy,
                           "ViewOpened",
                           G_TYPE_STRING, 
                           G_TYPE_STRING,
                           G_TYPE_INVALID);

  dbus_g_proxy_connect_signal (priv->proxy,
                               "ViewOpened",
                               (GCallback) bamf_matcher_on_view_opened,
                               self, NULL);

  dbus_g_proxy_add_signal (priv->proxy,
                           "ViewClosed",
                           G_TYPE_STRING, 
                           G_TYPE_STRING,
                           G_TYPE_INVALID);

  dbus_g_proxy_connect_signal (priv->proxy,
                               "ViewClosed",
                               (GCallback) bamf_matcher_on_view_closed,
                               self, NULL);

  dbus_g_proxy_add_signal (priv->proxy,
                           "ActiveApplicationChanged",
                           G_TYPE_STRING, 
                           G_TYPE_STRING,
                           G_TYPE_INVALID);

  dbus_g_proxy_connect_signal (priv->proxy,
                               "ActiveApplicationChanged",
                               (GCallback) bamf_matcher_on_active_application_changed,
                               self, NULL);

  dbus_g_proxy_add_signal (priv->proxy,
                           "ActiveWindowChanged",
                           G_TYPE_STRING, 
                           G_TYPE_STRING,
                           G_TYPE_INVALID);

  dbus_g_proxy_connect_signal (priv->proxy,
                               "ActiveWindowChanged",
                               (GCallback) bamf_matcher_on_active_window_changed,
                               self, NULL);

  dbus_g_proxy_add_signal (priv->proxy,
                           "StackingOrderChanged",
                           G_TYPE_INVALID);

  dbus_g_proxy_connect_signal (priv->proxy,
                               "StackingOrderChanged",
                               (GCallback) bamf_matcher_on_stacking_order_changed,
                               self, NULL);
}

Here is the call graph for this function:

static void bamf_matcher_on_active_application_changed ( DBusGProxy *  proxy,
char *  old_path,
char *  new_path,
BamfMatcher *  matcher 
) [static]

Definition at line 179 of file bamf-matcher.c.

{
  BamfView *old_view;
  BamfView *new_view;

  BamfFactory *factory = _bamf_factory_get_default ();
  old_view = _bamf_factory_view_for_path_type (factory, old_path, BAMF_FACTORY_APPLICATION);
  new_view = _bamf_factory_view_for_path_type (factory, new_path, BAMF_FACTORY_APPLICATION);

  g_signal_emit (matcher, matcher_signals[ACTIVE_APPLICATION_CHANGED], 0, old_view, new_view);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void bamf_matcher_on_active_window_changed ( DBusGProxy *  proxy,
char *  old_path,
char *  new_path,
BamfMatcher *  matcher 
) [static]

Definition at line 195 of file bamf-matcher.c.

{
  BamfView *old_view;
  BamfView *new_view;

  BamfFactory *factory = _bamf_factory_get_default ();
  old_view = _bamf_factory_view_for_path_type (factory, old_path, BAMF_FACTORY_WINDOW);
  new_view = _bamf_factory_view_for_path_type (factory, new_path, BAMF_FACTORY_WINDOW);

  g_signal_emit (matcher, matcher_signals[ACTIVE_WINDOW_CHANGED], 0, old_view, new_view);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void bamf_matcher_on_stacking_order_changed ( DBusGProxy *  proxy,
BamfMatcher *  matcher 
) [static]

Definition at line 211 of file bamf-matcher.c.

Here is the caller graph for this function:

static void bamf_matcher_on_view_closed ( DBusGProxy *  proxy,
char *  path,
char *  type,
BamfMatcher *  matcher 
) [static]

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

{
  BamfView *view;
  BamfFactory *factory = _bamf_factory_get_default ();

  view = _bamf_factory_view_for_path_type_str (factory, path, type);

  if (!BAMF_IS_VIEW (view))
    return;

  /* We manually set the view as closed, to avoid issues like bug #925421 */
  _bamf_view_set_closed (view, TRUE);
  g_signal_emit (matcher, matcher_signals[VIEW_CLOSED], 0, view);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void bamf_matcher_on_view_opened ( DBusGProxy *  proxy,
char *  path,
char *  type,
BamfMatcher *  matcher 
) [static]

Definition at line 141 of file bamf-matcher.c.

{
  BamfView *view;
  BamfFactory *factory = _bamf_factory_get_default ();

  view = _bamf_factory_view_for_path_type_str (factory, path, type);

  if (!BAMF_IS_VIEW (view))
    return;

  /* We manually set the view as not closed, to avoid issues like bug #925421 */
  _bamf_view_set_closed (view, FALSE);
  g_signal_emit (matcher, matcher_signals[VIEW_OPENED], 0, view);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void bamf_matcher_register_favorites ( BamfMatcher *  matcher,
const gchar **  favorites 
)

bamf_matcher_register_favorites: : a #BamfMatcher : an array of strings, each containing an absolute path to a .desktop file

Used to effect how bamf performs matching. Desktop files passed to this method will be prefered by bamf to system desktop files.

Definition at line 657 of file bamf-matcher.c.

{
  BamfMatcherPrivate *priv;

  g_return_if_fail (BAMF_IS_MATCHER (matcher));
  g_return_if_fail (favorites);
  
  priv = matcher->priv;

  dbus_g_proxy_call_no_reply (priv->proxy,
                              "RegisterFavorites",
                              G_TYPE_STRV, favorites,
                              G_TYPE_INVALID);
}

Here is the caller graph for this function:

G_DEFINE_TYPE ( BamfMatcher  ,
bamf_matcher  ,
G_TYPE_OBJECT   
)

SECTION:bamf-matcher : The base class for all matchers.

BamfMatcher is the base class that all matchers need to derive from.


Variable Documentation

BamfMatcher* default_matcher = NULL [static]

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

guint matcher_signals[LAST_SIGNAL] = { 0 } [static]

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