static gboolean
select_active_source_name (GtkTreeModel *model,
			   GtkTreePath  *path,
			   GtkTreeIter  *iter,
			   gpointer      data)
{
  GdictPrefDialog *dialog = GDICT_PREF_DIALOG (data);
  gboolean is_active;
  
  gtk_tree_model_get (model, iter,
      		      SOURCES_ACTIVE_COLUMN, &is_active,
      		      -1);
  if (is_active)
    {
      GtkTreeSelection *selection;
      
      selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->sources_view));
      
      gtk_tree_selection_select_iter (selection, iter);
      
      return TRUE;
    }
  
  return FALSE;
}
static void
gdict_pref_dialog_get_property (GObject    *object,
				guint       prop_id,
				GValue     *value,
				GParamSpec *pspec)
{
  GdictPrefDialog *dialog = GDICT_PREF_DIALOG (object);
  
  switch (prop_id)
    {
    case PROP_SOURCE_LOADER:
      g_value_set_object (value, dialog->loader);
      break;
    default:
      break;
    }
}
static void
gdict_pref_dialog_finalize (GObject *object)
{
  GdictPrefDialog *dialog = GDICT_PREF_DIALOG (object);
  
  if (dialog->settings)
    g_object_unref (dialog->settings);
  
  if (dialog->builder)
    g_object_unref (dialog->builder);

  if (dialog->active_source)
    g_free (dialog->active_source);
  
  if (dialog->loader)
    g_object_unref (dialog->loader);
  
  G_OBJECT_CLASS (gdict_pref_dialog_parent_class)->finalize (object);
}
예제 #4
0
static void
gdict_pref_dialog_gconf_notify_cb (GConfClient *client,
				   guint        cnxn_id,
				   GConfEntry  *entry,
				   gpointer     user_data)
{
  GdictPrefDialog *dialog = GDICT_PREF_DIALOG (user_data);
  
  if (strcmp (entry->key, GDICT_GCONF_SOURCE_KEY) == 0)
    {
      if (entry->value && entry->value->type == GCONF_VALUE_STRING)
        {
          g_free (dialog->active_source);
          dialog->active_source = g_strdup (gconf_value_get_string (entry->value));
        }
      else
        {
          g_free (dialog->active_source);
          dialog->active_source = g_strdup (GDICT_DEFAULT_SOURCE_NAME);
        }
      
      update_sources_view (dialog);
    }
  else if (strcmp (entry->key, GDICT_GCONF_PRINT_FONT_KEY) == 0)
    {
      if (entry->value && entry->value->type == GCONF_VALUE_STRING)
        {
          g_free (dialog->print_font);
          dialog->print_font = g_strdup (gconf_value_get_string (entry->value));
        }
      else
        {
          g_free (dialog->print_font);
          dialog->print_font = g_strdup (GDICT_DEFAULT_PRINT_FONT);
        }

      gtk_font_button_set_font_name (GTK_FONT_BUTTON (dialog->font_button),
		      		     dialog->print_font);
    }
}
예제 #5
0
static void
gdict_pref_dialog_finalize (GObject *object)
{
  GdictPrefDialog *dialog = GDICT_PREF_DIALOG (object);
  
  if (dialog->notify_id);
    gconf_client_notify_remove (dialog->gconf_client, dialog->notify_id);
  
  if (dialog->gconf_client)
    g_object_unref (dialog->gconf_client);
  
  if (dialog->builder)
    g_object_unref (dialog->builder);

  if (dialog->active_source)
    g_free (dialog->active_source);
  
  if (dialog->loader)
    g_object_unref (dialog->loader);
  
  G_OBJECT_CLASS (gdict_pref_dialog_parent_class)->finalize (object);
}