Back to index

indicator-appmenu  12.10.0
Classes | Defines | Typedefs | Functions
huditem.h File Reference
#include <glib-object.h>
#include "hudtoken.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _HudItemClass
struct  _HudItem

Defines

#define HUD_TYPE_ITEM   (hud_item_get_type ())
#define HUD_ITEM(inst)
#define HUD_ITEM_CLASS(class)
#define HUD_IS_ITEM(inst)   (G_TYPE_CHECK_INSTANCE_TYPE ((inst), HUD_TYPE_ITEM))
#define HUD_IS_ITEM_CLASS(class)   (G_TYPE_CHECK_CLASS_TYPE ((class), HUD_TYPE_ITEM))
#define HUD_ITEM_GET_CLASS(inst)

Typedefs

typedef struct _HudItemPrivate
typedef struct _HudItemClass
typedef struct _HudItem

Functions

GType hud_item_get_type (void)
gpointer hud_item_construct (GType g_type, HudStringList *tokens, const gchar *desktop_file, const gchar *app_icon, gboolean enabled)
 hud_item_construct: : a #GType : the search tokens for the item : the desktop file of the provider of the item : the icon name for the application that created this item : if the item is enabled
HudItem * hud_item_new (HudStringList *tokens, const gchar *desktop_file, const gchar *app_icon, gboolean enabled)
 hud_item_new: : the search tokens for the item : the desktop file of the provider of the item : the icon name for the application that created this item : if the item is enabled
void hud_item_activate (HudItem *item, GVariant *platform_data)
 hud_item_activate: : a #HudItem : platform data
HudStringList * hud_item_get_tokens (HudItem *item)
 hud_item_get_tokens: : a #HudItem
const gchar * hud_item_get_app_icon (HudItem *item)
 hud_item_get_app_icon: : a #HudItem
const gchar * hud_item_get_item_icon (HudItem *item)
 hud_item_get_item_icon: : a #HudItem
guint hud_item_get_usage (HudItem *item)
 hud_item_get_usage: : a #HudItem
gboolean hud_item_get_enabled (HudItem *item)
 hud_item_get_enabled: : a #HudItem
guint64 hud_item_get_id (HudItem *item)
 hud_item_get_id: : a #HudItem
HudItem * hud_item_lookup (guint64 id)
 hud_item_lookup: : an item identifier
HudTokenList * hud_item_get_token_list (HudItem *item)

Class Documentation

struct _HudItem

Definition at line 49 of file huditem.h.

Class Members
GObject parent_instance
HudItemPrivate * priv

Define Documentation

#define HUD_IS_ITEM (   inst)    (G_TYPE_CHECK_INSTANCE_TYPE ((inst), HUD_TYPE_ITEM))

Definition at line 31 of file huditem.h.

#define HUD_IS_ITEM_CLASS (   class)    (G_TYPE_CHECK_CLASS_TYPE ((class), HUD_TYPE_ITEM))

Definition at line 32 of file huditem.h.

#define HUD_ITEM (   inst)
Value:
(G_TYPE_CHECK_INSTANCE_CAST ((inst),                     \
                                                             HUD_TYPE_ITEM, HudItem))

Definition at line 27 of file huditem.h.

#define HUD_ITEM_CLASS (   class)
Value:
(G_TYPE_CHECK_CLASS_CAST ((class),                       \
                                                             HUD_TYPE_ITEM, HudItemClass))

Definition at line 29 of file huditem.h.

#define HUD_ITEM_GET_CLASS (   inst)
Value:
(G_TYPE_INSTANCE_GET_CLASS ((inst),                      \
                                                             HUD_TYPE_ITEM, HudItemClass))

Definition at line 33 of file huditem.h.

#define HUD_TYPE_ITEM   (hud_item_get_type ())

Definition at line 26 of file huditem.h.


Typedef Documentation

typedef struct _HudItem

Definition at line 39 of file huditem.h.

typedef struct _HudItemClass

Definition at line 38 of file huditem.h.

typedef struct _HudItemPrivate

Definition at line 37 of file huditem.h.


Function Documentation

void hud_item_activate ( HudItem *  item,
GVariant *  platform_data 
)

hud_item_activate: : a #HudItem : platform data

Activates .

is platform data in the #GApplication or

GRemoteActionGroup sense. It should be a #GVariant with the type

<literal>a{sv}</literal>.

Definition at line 208 of file huditem.c.

{
  g_return_if_fail (HUD_IS_ITEM (item));

  HUD_ITEM_GET_CLASS (item)
    ->activate (item, platform_data);

  if (item->priv->usage_tag)
    {
      usage_tracker_mark_usage (usage_tracker_get_instance (), item->priv->desktop_file, item->priv->usage_tag);
      item->priv->usage = usage_tracker_get_usage (usage_tracker_get_instance (),
                                                   item->priv->desktop_file, item->priv->usage_tag);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

gpointer hud_item_construct ( GType  g_type,
HudStringList *  tokens,
const gchar *  desktop_file,
const gchar *  app_icon,
gboolean  enabled 
)

hud_item_construct: : a #GType : the search tokens for the item : the desktop file of the provider of the item : the icon name for the application that created this item : if the item is enabled

This is the Vala-style chain-up constructor corresponding to hud_item_new(). must be a subtype of #HudItem.

Only subclasses of #HudItem should call this.

Returns: a new #HudItem or #HudItem subclass

Definition at line 149 of file huditem.c.

{
  HudItem *item;

  item = g_object_new (g_type, NULL);
  item->priv->tokens = hud_string_list_ref (tokens);
  item->priv->desktop_file = g_strdup (desktop_file);
  item->priv->app_icon = g_strdup (app_icon);
  item->priv->enabled = enabled;
  item->priv->id = hud_item_next_id++;
  item->priv->token_list = hud_token_list_new_from_string_list (tokens);

  g_hash_table_insert (hud_item_table, &item->priv->id, item);

  if (desktop_file)
    hud_item_setup_usage (item);

  return item;
}

Here is the call graph for this function:

Here is the caller graph for this function:

const gchar* hud_item_get_app_icon ( HudItem *  item)

hud_item_get_app_icon: : a #HudItem

Gets the icon of the application that lies within.

Returns: the icon name, or "" if there is no icon

Definition at line 267 of file huditem.c.

{
  return item->priv->app_icon ? item->priv->app_icon : "";
}

Here is the caller graph for this function:

gboolean hud_item_get_enabled ( HudItem *  item)

hud_item_get_enabled: : a #HudItem

Checks if the item is disabled or enabled.

Disabled items should never appear in search results.

Returns: if the item is enabled

Definition at line 300 of file huditem.c.

{
  return item->priv->enabled;
}

Here is the caller graph for this function:

guint64 hud_item_get_id ( HudItem *  item)

hud_item_get_id: : a #HudItem

Gets the unique identifier of this #HudItem.

The identifier can be used to refetch the item using hud_item_lookup() for as long as the item has not been destroyed.

Returns: the ID of the item

Definition at line 317 of file huditem.c.

{
  return item->priv->id;
}

Here is the caller graph for this function:

const gchar* hud_item_get_item_icon ( HudItem *  item)

hud_item_get_item_icon: : a #HudItem

Gets the icon for the action represented by , if one exists.

Returns: the icon name, or "" if there is no icon

Definition at line 253 of file huditem.c.

{
  return "";
}

Here is the caller graph for this function:

HudTokenList* hud_item_get_token_list ( HudItem *  item)

Definition at line 340 of file huditem.c.

{
  return item->priv->token_list;
}

Here is the caller graph for this function:

HudStringList* hud_item_get_tokens ( HudItem *  item)

hud_item_get_tokens: : a #HudItem

Gets the tokens that represent the description of .

This is a #HudStringList in reverse order of how the item should appear in the Hud. For example, "File > Open" would be represneted by the list ['Open', 'File'].

Returns: (transfer none): the tokens

Definition at line 237 of file huditem.c.

{
  g_return_val_if_fail (HUD_IS_ITEM (item), NULL);

  return item->priv->tokens;
}

Here is the caller graph for this function:

GType hud_item_get_type ( void  )
guint hud_item_get_usage ( HudItem *  item)

hud_item_get_usage: : a #HudItem

Gets the use-count of .

This is the number of times the item has been activated in recent history.

Returns: the usage count

Definition at line 284 of file huditem.c.

{
  return item->priv->usage;
}

Here is the caller graph for this function:

HudItem* hud_item_lookup ( guint64  id)

hud_item_lookup: : an item identifier

Looks up a #HudItem by its ID.

The ID for a #HudItem can be queried with hud_item_get_id().

Returns: (transfer none): the #HudItem with the given , or NULL if none exists

Definition at line 334 of file huditem.c.

{
  return g_hash_table_lookup (hud_item_table, &id);
}

Here is the caller graph for this function:

HudItem* hud_item_new ( HudStringList *  tokens,
const gchar *  desktop_file,
const gchar *  app_icon,
gboolean  enabled 
)

hud_item_new: : the search tokens for the item : the desktop file of the provider of the item : the icon name for the application that created this item : if the item is enabled

Creates a new #HudItem.

If is FALSE then the item will never be in the result of a search.

Returns: a new #HudItem

Definition at line 188 of file huditem.c.

{
  return hud_item_construct (HUD_TYPE_ITEM, tokens, desktop_file, app_icon, enabled);
}

Here is the call graph for this function:

Here is the caller graph for this function: