Back to index

indicator-appmenu  12.10.0
Classes | Typedefs | Functions
huddebugsource.c File Reference
#include "huddebugsource.h"
#include "hudsource.h"
#include "hudresult.h"

Go to the source code of this file.

Classes

struct  _HudDebugSource
 SECTION:huddebugsource : HudDebugSource : a source to assist with debugging. More...

Typedefs

typedef GObjectClass HudDebugSourceClass

Functions

static void hud_debug_source_iface_init (HudSourceInterface *iface)
 G_DEFINE_TYPE_WITH_CODE (HudDebugSource, hud_debug_source, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE(HUD_TYPE_SOURCE, hud_debug_source_iface_init))
static void hud_debug_source_use (HudSource *hud_source)
static void hud_debug_source_unuse (HudSource *hud_source)
static void hud_debug_source_search (HudSource *hud_source, GPtrArray *results_array, HudTokenList *search_string)
static void hud_debug_source_finalize (GObject *object)
static void hud_debug_source_init (HudDebugSource *source)
static void hud_debug_source_class_init (HudDebugSourceClass *class)
HudDebugSource * hud_debug_source_new (void)
 hud_debug_source_new:

Class Documentation

struct _HudDebugSource

SECTION:huddebugsource : HudDebugSource : a source to assist with debugging.

HudDebugSource is a source for debugging purposes. It is not

enabled by default but you can have it added to the global list of sources by setting the HUD_DEBUG_SOURCE environment variable.

Presently it creates a #HudItem corresponding to the current date and time (and updates it as the time changes). HudDebugSource:

This is an opaque structure type.

Definition at line 43 of file huddebugsource.c.

Class Members
HudItem * item
GObject parent_instance
gint timeout
gint use_count

Typedef Documentation

typedef GObjectClass HudDebugSourceClass

Definition at line 52 of file huddebugsource.c.


Function Documentation

G_DEFINE_TYPE_WITH_CODE ( HudDebugSource  ,
hud_debug_source  ,
G_TYPE_OBJECT  ,
G_IMPLEMENT_INTERFACE(HUD_TYPE_SOURCE, hud_debug_source_iface_init  
)

Definition at line 55 of file huddebugsource.c.

{
  HudDebugSource *source = user_data;
  HudStringList *tokens;
  GDateTime *now;
  gchar *time;

  g_clear_object (&source->item);

  now = g_date_time_new_now_local ();
  time = g_date_time_format (now, "hud-debug time: %c");
  tokens = hud_string_list_cons (time, NULL);
  g_date_time_unref (now);
  g_free (time);

  source->item = hud_item_new (tokens, NULL, NULL, TRUE);
  hud_string_list_unref (tokens);

  hud_source_changed (HUD_SOURCE (source));

  return TRUE;
}

Here is the call graph for this function:

static void hud_debug_source_class_init ( HudDebugSourceClass class) [static]

Definition at line 152 of file huddebugsource.c.

{
  class->finalize = hud_debug_source_finalize;
}

Here is the call graph for this function:

static void hud_debug_source_finalize ( GObject *  object) [static]

Definition at line 125 of file huddebugsource.c.

{
  HudDebugSource *source = HUD_DEBUG_SOURCE (object);

  g_clear_object (&source->item);

  if (source->timeout)
    g_source_remove (source->timeout);

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

Here is the caller graph for this function:

static void hud_debug_source_iface_init ( HudSourceInterface *  iface) [static]

Definition at line 144 of file huddebugsource.c.

{
  iface->use = hud_debug_source_use;
  iface->unuse = hud_debug_source_unuse;
  iface->search = hud_debug_source_search;
}

Here is the call graph for this function:

static void hud_debug_source_init ( HudDebugSource *  source) [static]

Definition at line 139 of file huddebugsource.c.

{
}
HudDebugSource* hud_debug_source_new ( void  )

hud_debug_source_new:

Creates a #HudDebugSource.

Returns: a new empty #HudDebugSource

Definition at line 165 of file huddebugsource.c.

{
  return g_object_new (HUD_TYPE_DEBUG_SOURCE, NULL);
}

Here is the caller graph for this function:

static void hud_debug_source_search ( HudSource *  hud_source,
GPtrArray *  results_array,
HudTokenList *  search_string 
) [static]

Definition at line 108 of file huddebugsource.c.

{
  HudDebugSource *source = HUD_DEBUG_SOURCE (hud_source);

  if (source->item)
    {
      HudResult *result;

      result = hud_result_get_if_matched (source->item, search_string, 0);
      if (result != NULL)
        g_ptr_array_add (results_array, result);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void hud_debug_source_unuse ( HudSource *  hud_source) [static]

Definition at line 94 of file huddebugsource.c.

{
  HudDebugSource *source = HUD_DEBUG_SOURCE (hud_source);

  source->use_count--;

  if (source->use_count == 0)
    {
      g_source_remove (source->timeout);
      source->timeout = 0;
    }
}

Here is the caller graph for this function:

static void hud_debug_source_use ( HudSource *  hud_source) [static]

Definition at line 83 of file huddebugsource.c.

{
  HudDebugSource *source = HUD_DEBUG_SOURCE (hud_source);

  if (source->use_count == 0)
    source->timeout = g_timeout_add (1000, hud_debug_source_timeout, source);

  source->use_count++;
}

Here is the caller graph for this function: