Example #1
0
static void
inf_user_table_dispose_foreach_func(gpointer key,
                                    gpointer value,
                                    gpointer user_data)
{
  inf_user_table_unref_user(INF_USER_TABLE(user_data), INF_USER(value));
}
Example #2
0
static void
inf_user_table_check_local_cb(GObject* object,
                              GParamSpec* pspec,
                              gpointer user_data)
{
  InfUserTable* user_table;
  InfUserTablePrivate* priv;
  GSList* item;

  user_table = INF_USER_TABLE(user_data);
  priv = INF_USER_TABLE_PRIVATE(user_table);
  item = g_slist_find(priv->locals, INF_USER(object));

  if(inf_user_table_is_local(INF_USER(object)) && item == NULL)
  {
    g_signal_emit(
      G_OBJECT(user_table),
      user_table_signals[ADD_LOCAL_USER],
      0,
      INF_USER(object)
    );
  }
  
  if(!inf_user_table_is_local(INF_USER(object)) && item != NULL)
  {
    g_signal_emit(
      G_OBJECT(user_table),
      user_table_signals[REMOVE_LOCAL_USER],
      0,
      INF_USER(object)
    );
  }
}
Example #3
0
static void
inf_user_table_finalize(GObject* object)
{
  InfUserTable* user_table;
  InfUserTablePrivate* priv;

  user_table = INF_USER_TABLE(object);
  priv = INF_USER_TABLE_PRIVATE(user_table);

  g_hash_table_destroy(priv->table);

  G_OBJECT_CLASS(parent_class)->finalize(object);
}
Example #4
0
static void
inf_user_table_init(GTypeInstance* instance,
                    gpointer g_class)
{
  InfUserTable* user_table;
  InfUserTablePrivate* priv;

  user_table = INF_USER_TABLE(instance);
  priv = INF_USER_TABLE_PRIVATE(user_table);

  priv->table = g_hash_table_new_full(NULL, NULL, NULL, NULL);
  priv->locals = NULL;
}
static void
inf_text_gtk_viewport_set_property(GObject* object,
                                   guint prop_id,
                                   const GValue* value,
                                   GParamSpec* pspec)
{
  InfTextGtkViewport* viewport;
  InfTextGtkViewportPrivate* priv;

  viewport = INF_TEXT_GTK_VIEWPORT(object);
  priv = INF_TEXT_GTK_VIEWPORT_PRIVATE(viewport);

  switch(prop_id)
  {
  case PROP_SCROLLED_WINDOW:
    g_assert(priv->scroll == NULL); /* construct only */

    inf_text_gtk_viewport_set_scrolled_window(
      viewport,
      GTK_SCROLLED_WINDOW(g_value_get_object(value))
    );

    break;
  case PROP_USER_TABLE:
    g_assert(priv->user_table == NULL); /* construct/only */

    inf_text_gtk_viewport_set_user_table(
      viewport,
      INF_USER_TABLE(g_value_get_object(value))
    );

    break;
  case PROP_ACTIVE_USER:
    inf_text_gtk_viewport_set_active_user(
      viewport,
      INF_TEXT_USER(g_value_get_object(value))
    );

    break;
  case PROP_SHOW_USER_MARKERS:
    inf_text_gtk_viewport_set_show_user_markers(
      viewport,
      g_value_get_boolean(value)
    );

    break;
  default:
    G_OBJECT_WARN_INVALID_PROPERTY_ID(value, prop_id, pspec);
    break;
  }
}
Example #6
0
static void
inf_user_table_dispose(GObject* object)
{
  InfUserTable* user_table;
  InfUserTablePrivate* priv;

  user_table = INF_USER_TABLE(object);
  priv = INF_USER_TABLE_PRIVATE(user_table);

  g_slist_free(priv->locals);
  priv->locals = NULL;

  g_hash_table_foreach(
    priv->table,
    inf_user_table_dispose_foreach_func,
    user_table
  );

  g_hash_table_remove_all(priv->table);
  G_OBJECT_CLASS(parent_class)->dispose(object);
}
Example #7
0
/**
 * inf_user_table_new:
 *
 * Creates a new, empty user table.
 *
 * Return Value: A #InfUserTable.
 **/
InfUserTable*
inf_user_table_new(void)
{
  return INF_USER_TABLE(g_object_new(INF_TYPE_USER_TABLE, NULL));
}