Back to index

bamf  0.2.120
Classes | Defines | Functions
bamf-application.c File Reference
#include "bamf-application.h"
#include "bamf-window.h"
#include "bamf-matcher.h"
#include "bamf-indicator.h"
#include "bamf-legacy-window.h"
#include "bamf-legacy-screen.h"
#include <string.h>
#include <gio/gdesktopappinfo.h>

Go to the source code of this file.

Classes

struct  _BamfApplicationPrivate

Defines

#define BAMF_APPLICATION_GET_PRIVATE(obj)
#define STUB_KEY   "X-Ayatana-Appmenu-Show-Stubs"

Functions

static void bamf_application_dbus_application_iface_init (BamfDBusItemApplicationIface *iface)
 G_DEFINE_TYPE_WITH_CODE (BamfApplication, bamf_application, BAMF_TYPE_VIEW, G_IMPLEMENT_INTERFACE(BAMF_DBUS_ITEM_TYPE_APPLICATION, bamf_application_dbus_application_iface_init))
static const char * bamf_application_get_icon (BamfView *view)
char * bamf_application_get_application_type (BamfApplication *application)
 bamf_application_get_applicaton_type: : a #BamfApplication
const char * bamf_application_get_desktop_file (BamfApplication *application)
 bamf_application_get_desktop_file: : a #BamfApplication
const char * bamf_application_get_wmclass (BamfApplication *application)
static gboolean icon_name_is_valid (char *name)
static void bamf_application_setup_icon_and_name (BamfApplication *self)
void bamf_application_set_desktop_file (BamfApplication *application, const char *desktop_file)
void bamf_application_set_wmclass (BamfApplication *application, const char *wmclass)
GVariant * bamf_application_get_xids (BamfApplication *application)
 bamf_application_get_xids: : a #BamfApplication
gboolean bamf_application_contains_similar_to_window (BamfApplication *self, BamfWindow *bamf_window)
gboolean bamf_application_manages_xid (BamfApplication *application, guint32 xid)
static const char * bamf_application_get_view_type (BamfView *view)
static char * bamf_application_get_stable_bus_name (BamfView *view)
static void bamf_application_ensure_flags (BamfApplication *self)
static void view_active_changed (BamfView *view, gboolean active, BamfApplication *self)
static void view_urgent_changed (BamfView *view, gboolean urgent, BamfApplication *self)
static void view_visible_changed (BamfView *view, gboolean visible, BamfApplication *self)
static void view_exported (BamfView *view, BamfApplication *self)
static void bamf_application_child_added (BamfView *view, BamfView *child)
static char * bamf_application_favorite_from_list (BamfApplication *self, GList *desktop_list)
static void bamf_application_set_desktop_file_from_list (BamfApplication *self, GList *list)
static void bamf_application_child_removed (BamfView *view, BamfView *child)
static void matcher_favorites_changed (BamfMatcher *matcher, BamfApplication *self)
static void on_window_added (BamfApplication *self, const gchar *win_path, gpointer _not_used)
static void on_window_removed (BamfApplication *self, const gchar *win_path, gpointer _not_used)
static gboolean on_dbus_handle_show_stubs (BamfDBusItemApplication *interface, GDBusMethodInvocation *invocation, BamfApplication *self)
static gboolean on_dbus_handle_xids (BamfDBusItemApplication *interface, GDBusMethodInvocation *invocation, BamfApplication *self)
static gboolean on_dbus_handle_desktop_file (BamfDBusItemApplication *interface, GDBusMethodInvocation *invocation, BamfApplication *self)
static gboolean on_dbus_handle_application_type (BamfDBusItemApplication *interface, GDBusMethodInvocation *invocation, BamfApplication *self)
static void bamf_application_dispose (GObject *object)
static void bamf_application_finalize (GObject *object)
static void bamf_application_init (BamfApplication *self)
static void bamf_application_class_init (BamfApplicationClass *klass)
BamfApplication * bamf_application_new (void)
BamfApplication * bamf_application_new_from_desktop_file (const char *desktop_file)
BamfApplication * bamf_application_new_from_desktop_files (GList *desktop_files)
BamfApplication * bamf_application_new_with_wmclass (const char *wmclass)
gboolean bamf_application_get_show_stubs (BamfApplication *application)
 bamf_application_get_show_stubs: : Application to check for menu stubs

Class Documentation

struct _BamfApplicationPrivate

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

Class Members
char * app_type
gchar * application_type
GList * cached_xids
DBusGConnection * connection
BamfDBusItemApplication * dbus_iface
char * desktop_file
gchar * desktop_file
GList * desktop_file_list
char * icon
gboolean is_tab_container
DBusGProxy * proxy
gboolean show_stubs
int show_stubs
char * wmclass

Define Documentation

#define BAMF_APPLICATION_GET_PRIVATE (   obj)
Value:
(G_TYPE_INSTANCE_GET_PRIVATE(obj, \
BAMF_TYPE_APPLICATION, BamfApplicationPrivate))

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

#define STUB_KEY   "X-Ayatana-Appmenu-Show-Stubs"

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


Function Documentation

static void bamf_application_child_added ( BamfView *  view,
BamfView *  child 
) [static]

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

{
  BamfApplication *application;

  application = BAMF_APPLICATION (view);

  if (BAMF_IS_WINDOW (child))
    {
      if (bamf_view_is_on_bus (child))
        g_signal_emit_by_name (BAMF_APPLICATION (view), "window-added", bamf_view_get_path (child));
      else
        g_signal_connect (G_OBJECT (child), "exported",
                          (GCallback) view_exported, view);
    }

  g_signal_connect (G_OBJECT (child), "active-changed",
                    (GCallback) view_active_changed, view);
  g_signal_connect (G_OBJECT (child), "urgent-changed",
                    (GCallback) view_urgent_changed, view);
  g_signal_connect (G_OBJECT (child), "user-visible-changed",
                    (GCallback) view_visible_changed, view);

  bamf_application_ensure_flags (BAMF_APPLICATION (view));

  bamf_application_setup_icon_and_name (application);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void bamf_application_child_removed ( BamfView *  view,
BamfView *  child 
) [static]

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

{
  if (BAMF_IS_WINDOW (child))
    {
      if (bamf_view_is_on_bus (child))
        g_signal_emit_by_name (BAMF_APPLICATION (view), "window-removed",
                               bamf_view_get_path (child));
    }

  g_signal_handlers_disconnect_by_func (G_OBJECT (child), view_active_changed, view);
  g_signal_handlers_disconnect_by_func (G_OBJECT (child), view_urgent_changed, view);
  g_signal_handlers_disconnect_by_func (G_OBJECT (child), view_visible_changed, view);

  bamf_application_ensure_flags (BAMF_APPLICATION (view));

  if (bamf_view_get_children (view) == NULL)
    {
      bamf_view_close (view);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void bamf_application_class_init ( BamfApplicationClass *  klass) [static]

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

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

  object_class->dispose = bamf_application_dispose;
  object_class->finalize = bamf_application_finalize;

  view_class->view_type = bamf_application_get_view_type;
  view_class->child_added = bamf_application_child_added;
  view_class->child_removed = bamf_application_child_removed;
  view_class->get_icon = bamf_application_get_icon;
  view_class->stable_bus_name = bamf_application_get_stable_bus_name;

  g_type_class_add_private (klass, sizeof (BamfApplicationPrivate));
}

Here is the call graph for this function:

gboolean bamf_application_contains_similar_to_window ( BamfApplication *  self,
BamfWindow *  bamf_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:

static void bamf_application_dbus_application_iface_init ( BamfDBusItemApplicationIface *  iface) [static]

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

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

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

{
  BamfApplication *app;
  BamfApplicationPrivate *priv;

  app = BAMF_APPLICATION (object);
  priv = app->priv;

  if (priv->desktop_file)
    {
      g_free (priv->desktop_file);
      priv->desktop_file = NULL;
    }
    
  if (priv->desktop_file_list)
    {
      g_list_free_full (priv->desktop_file_list, g_free);
      priv->desktop_file_list = NULL;
    }

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

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

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

  g_signal_handlers_disconnect_by_func (G_OBJECT (bamf_matcher_get_default ()),
                                        matcher_favorites_changed, object);

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

Here is the call graph for this function:

Here is the caller graph for this function:

static void bamf_application_ensure_flags ( BamfApplication *  self) [static]

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

{
  gboolean urgent = FALSE, visible = FALSE, running = FALSE, active = FALSE;
  GList *l;
  BamfView *view;

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

      if (!BAMF_IS_VIEW (view))
        continue;

      running = TRUE;
      
      if (BAMF_IS_INDICATOR (view))
        visible = TRUE;

      if (!BAMF_IS_WINDOW (view))
        continue;

      if (bamf_view_is_urgent (view))
        urgent = TRUE;
      if (bamf_view_user_visible (view))
        visible = TRUE;
      if (bamf_view_is_active (view))
        active = TRUE;

      if (urgent && visible && active)
        break;
    }

  bamf_view_set_urgent       (BAMF_VIEW (self), urgent);
  bamf_view_set_user_visible (BAMF_VIEW (self), visible);
  bamf_view_set_running      (BAMF_VIEW (self), running);
  bamf_view_set_active       (BAMF_VIEW (self), active);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static char* bamf_application_favorite_from_list ( BamfApplication *  self,
GList *  desktop_list 
) [static]

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

{
  BamfMatcher *matcher;
  GList *favs, *l;
  char *result = NULL;
  const char *desktop_class;

  g_return_val_if_fail (BAMF_IS_APPLICATION (self), NULL);

  matcher = bamf_matcher_get_default ();
  favs = bamf_matcher_get_favorites (matcher);
  
  if (favs)
    {
      for (l = favs; l; l = l->next)
        {
          if (g_list_find_custom (desktop_list, l->data, (GCompareFunc) g_strcmp0))
            {
              desktop_class = bamf_matcher_get_desktop_file_class (matcher, l->data);

              if (!desktop_class || g_strcmp0 (self->priv->wmclass, desktop_class) == 0)
                {
                  result = l->data;
                  break;
                }
            }
        }
    }

  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void bamf_application_finalize ( GObject *  object) [static]

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

{
  BamfApplication *self;
  self = BAMF_APPLICATION (object);

  g_object_unref (self->priv->dbus_iface);

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

Here is the caller graph for this function:

char* 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 61 of file bamf-application.c.

{
  g_return_val_if_fail (BAMF_IS_APPLICATION (application), NULL);

  return g_strdup (application->priv->app_type);
}

Here is the call 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 69 of file bamf-application.c.

{
  BamfApplicationPrivate *priv;

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

  return priv->desktop_file;
}

Here is the call graph for this function:

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

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

{
  g_return_val_if_fail (BAMF_IS_APPLICATION (view), NULL);

  return BAMF_APPLICATION (view)->priv->icon;
}

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:

static char* bamf_application_get_stable_bus_name ( BamfView *  view) [static]

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

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

  g_return_val_if_fail (BAMF_IS_APPLICATION (view), NULL);
  self = BAMF_APPLICATION (view);

  if (self->priv->desktop_file)
    return g_strdup_printf ("application%i", abs (g_str_hash (self->priv->desktop_file)));

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

      if (!BAMF_IS_WINDOW (child))
        continue;

      return g_strdup_printf ("application%s", 
                              bamf_legacy_window_get_class_name (bamf_window_get_window (BAMF_WINDOW (child))));
    }
  
  return g_strdup_printf ("application%p", view);
}

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

{
  return "application";
}

Here is the caller graph for this function:

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 277 of file bamf-application.c.

{
  GList *l;
  GVariantBuilder b;
  BamfView *view;
  guint32 xid;

  g_return_val_if_fail (BAMF_IS_APPLICATION (application), NULL);

  g_variant_builder_init (&b, G_VARIANT_TYPE ("(au)"));
  g_variant_builder_open (&b, G_VARIANT_TYPE ("au"));

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

      if (!BAMF_IS_WINDOW (view))
        continue;

      xid = bamf_window_get_xid (BAMF_WINDOW (view));
      g_variant_builder_add (&b, "u", xid);
    }

  g_variant_builder_close (&b);

  return g_variant_builder_end (&b);
}

Here is the call graph for this function:

static void bamf_application_init ( BamfApplication *  self) [static]

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

{
  BamfApplicationPrivate *priv;
  priv = self->priv = BAMF_APPLICATION_GET_PRIVATE (self);

  priv->is_tab_container = FALSE;
  priv->app_type = g_strdup ("system");
  priv->show_stubs = TRUE;
  priv->wmclass = NULL;

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

  /* We need to connect to the object own signals to redirect them to the dbus
   * interface                                                                */
  g_signal_connect (self, "window-added", G_CALLBACK (on_window_added), NULL);
  g_signal_connect (self, "window-removed", G_CALLBACK (on_window_removed), NULL);

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

  g_signal_connect (priv->dbus_iface, "handle-xids",
                    G_CALLBACK (on_dbus_handle_xids), self);

  g_signal_connect (priv->dbus_iface, "handle-desktop-file",
                    G_CALLBACK (on_dbus_handle_desktop_file), self);

  g_signal_connect (priv->dbus_iface, "handle-application-type",
                    G_CALLBACK (on_dbus_handle_application_type), self);

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

  g_signal_connect (G_OBJECT (bamf_matcher_get_default ()), "favorites-changed", 
                    (GCallback) matcher_favorites_changed, self);
}

Here is the call 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:

static void bamf_application_set_desktop_file_from_list ( BamfApplication *  self,
GList *  list 
) [static]

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

{
  BamfApplicationPrivate *priv;
  GList *l;
  char *desktop_file;

  g_return_if_fail (BAMF_IS_APPLICATION (self));
  g_return_if_fail (list);

  priv = self->priv;

  if (priv->desktop_file_list)
    {
      g_list_free_full (priv->desktop_file_list, g_free);
      priv->desktop_file_list = NULL;
    }

  for (l = list; l; l = l->next)
    priv->desktop_file_list = g_list_prepend (priv->desktop_file_list, g_strdup (l->data));

  priv->desktop_file_list = g_list_reverse (priv->desktop_file_list);

  desktop_file = bamf_application_favorite_from_list (self, priv->desktop_file_list);
  
  /* items, after reversing them, are in priority order */
  if (!desktop_file)
    desktop_file = list->data;

  bamf_application_set_desktop_file (self, desktop_file);
}

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:

static void bamf_application_setup_icon_and_name ( BamfApplication *  self) [static]

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

{
  BamfView *view;
  BamfWindow *window = NULL;
  GDesktopAppInfo *desktop;
  GKeyFile * keyfile;
  GIcon *gicon;
  GList *children, *l;
  const char *class;
  char *icon = NULL, *name = NULL;
  GError *error;

  g_return_if_fail (BAMF_IS_APPLICATION (self));

  if (self->priv->icon && bamf_view_get_name (BAMF_VIEW (self)))
    return;

  if (self->priv->desktop_file)
    {
      keyfile = g_key_file_new();

      if (!g_key_file_load_from_file(keyfile, self->priv->desktop_file, G_KEY_FILE_NONE, NULL))
        {
          g_key_file_free(keyfile);
          return;
        }

      desktop = g_desktop_app_info_new_from_keyfile (keyfile);

      if (!G_IS_APP_INFO (desktop))
        {
          g_key_file_free(keyfile);
          return;
        }

      gicon = g_app_info_get_icon (G_APP_INFO (desktop));

      name = g_strdup (g_app_info_get_display_name (G_APP_INFO (desktop)));

      if (gicon)
        icon = g_icon_to_string (gicon);

      if (g_key_file_has_key(keyfile, G_KEY_FILE_DESKTOP_GROUP, STUB_KEY, NULL))
        {
          /* This will error to return false, which is okay as it seems
             unlikely anyone will want to set this flag except to turn
             off the stub menus. */
          self->priv->show_stubs = g_key_file_get_boolean (keyfile,
                                                           G_KEY_FILE_DESKTOP_GROUP,
                                                           STUB_KEY, NULL);
        }
      
      if (g_key_file_has_key (keyfile, G_KEY_FILE_DESKTOP_GROUP, "X-GNOME-FullName", NULL))
        {
          /* Grab the better name if its available */
          gchar *fullname = NULL;
          error = NULL; 
          fullname = g_key_file_get_locale_string (keyfile,
                                                   G_KEY_FILE_DESKTOP_GROUP,
                                                   "X-GNOME-FullName", NULL,
                                                   &error);
          if (error != NULL)
            {
              g_error_free (error);
              if (fullname)
                g_free (fullname);
            }
          else
            {
              g_free (name);
              name = fullname;
            }
        }

      g_object_unref (desktop);
      g_key_file_free(keyfile);
    }
  else if ((children = bamf_view_get_children (BAMF_VIEW (self))) != NULL)
    {
      for (l = children; l && !icon; l = l->next)
        {
          view = l->data;
          if (!BAMF_IS_WINDOW (view))
            continue;
          
          window = BAMF_WINDOW (view);
          
          do
            {
              class = bamf_legacy_window_get_class_name (bamf_window_get_window (window));
              icon = g_utf8_strdown (class, -1);

              if (icon_name_is_valid (icon))
                break;

              g_free (icon);
              icon = bamf_legacy_window_get_exec_string (bamf_window_get_window (window));

              if (icon_name_is_valid (icon))
                break;

              g_free (icon);
              icon = NULL;
            }
          while (FALSE);

          name = g_strdup (bamf_legacy_window_get_name (bamf_window_get_window (window)));
        }
        
      if (!icon)
        {
          if (window)
            {
              icon = g_strdup (bamf_legacy_window_save_mini_icon (bamf_window_get_window (window)));
            }
          
          if (!icon)
            {
              icon = g_strdup ("application-default-icon");
            }
        }
    }
  else
    {
      /* we do nothing as we have nothing to go on */
    }

  if (icon)
    {
      if (self->priv->icon)
        g_free (self->priv->icon);

      self->priv->icon = icon;
    }

  if (name)
    bamf_view_set_name (BAMF_VIEW (self), name);

  g_free (name);
}

Here is the call graph for this function:

Here is the caller graph for this function:

G_DEFINE_TYPE_WITH_CODE ( BamfApplication  ,
bamf_application  ,
BAMF_TYPE_VIEW  ,
G_IMPLEMENT_INTERFACE(BAMF_DBUS_ITEM_TYPE_APPLICATION, bamf_application_dbus_application_iface_init  
)
static gboolean icon_name_is_valid ( char *  name) [static]

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

{
  GtkIconTheme *icon_theme;

  if (name == NULL)
    return FALSE;

  icon_theme = gtk_icon_theme_get_default ();
  return gtk_icon_theme_has_icon (icon_theme, name);
}

Here is the caller graph for this function:

static void matcher_favorites_changed ( BamfMatcher *  matcher,
BamfApplication *  self 
) [static]

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

{
  char *new_desktop_file = NULL;
  
  g_return_if_fail (BAMF_IS_APPLICATION (self));
  g_return_if_fail (BAMF_IS_MATCHER (matcher));
  
  new_desktop_file = bamf_application_favorite_from_list (self, self->priv->desktop_file_list);

  if (new_desktop_file)
    {
      bamf_application_set_desktop_file (self, new_desktop_file);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static gboolean on_dbus_handle_application_type ( BamfDBusItemApplication *  interface,
GDBusMethodInvocation *  invocation,
BamfApplication *  self 
) [static]

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

{
  const char *type = self->priv->app_type ? self->priv->app_type : "";
  g_dbus_method_invocation_return_value (invocation,
                                         g_variant_new ("(s)", type));

  return TRUE;
}

Here is the caller graph for this function:

static gboolean on_dbus_handle_desktop_file ( BamfDBusItemApplication *  interface,
GDBusMethodInvocation *  invocation,
BamfApplication *  self 
) [static]

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

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

  return TRUE;
}

Here is the caller graph for this function:

static gboolean on_dbus_handle_show_stubs ( BamfDBusItemApplication *  interface,
GDBusMethodInvocation *  invocation,
BamfApplication *  self 
) [static]

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

{
  gboolean show_stubs = bamf_application_get_show_stubs (self);
  g_dbus_method_invocation_return_value (invocation,
                                         g_variant_new ("(b)", show_stubs));

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static gboolean on_dbus_handle_xids ( BamfDBusItemApplication *  interface,
GDBusMethodInvocation *  invocation,
BamfApplication *  self 
) [static]

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

{
  GVariant *xids = bamf_application_get_xids (self);
  g_dbus_method_invocation_return_value (invocation, xids);

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void on_window_added ( BamfApplication *  self,
const gchar *  win_path,
gpointer  _not_used 
) [static]

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

{
  g_return_if_fail (BAMF_IS_APPLICATION (self));
  g_signal_emit_by_name (self->priv->dbus_iface, "window-added", win_path);
}

Here is the caller graph for this function:

static void on_window_removed ( BamfApplication *  self,
const gchar *  win_path,
gpointer  _not_used 
) [static]

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

{
  g_return_if_fail (BAMF_IS_APPLICATION (self));
  g_signal_emit_by_name (self->priv->dbus_iface, "window-removed", win_path);
}

Here is the caller graph for this function:

static void view_active_changed ( BamfView *  view,
gboolean  active,
BamfApplication *  self 
) [static]

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

Here is the call graph for this function:

Here is the caller graph for this function:

static void view_exported ( BamfView *  view,
BamfApplication *  self 
) [static]

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

{
  g_signal_emit_by_name (self, "window-added", bamf_view_get_path (view));
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void view_urgent_changed ( BamfView *  view,
gboolean  urgent,
BamfApplication *  self 
) [static]

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

Here is the call graph for this function:

Here is the caller graph for this function:

static void view_visible_changed ( BamfView *  view,
gboolean  visible,
BamfApplication *  self 
) [static]

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

Here is the call graph for this function:

Here is the caller graph for this function: