コード例 #1
0
ファイル: font_features.c プロジェクト: Distrotech/gtk
static void
update (void)
{
  GString *s;
  char *font_desc;
  char *font_settings;
  const char *text;
  gboolean has_feature;
  int i;

  text = gtk_entry_get_text (GTK_ENTRY (entry));

  font_desc = gtk_font_chooser_get_font (GTK_FONT_CHOOSER (font));

  s = g_string_new ("");

  has_feature = FALSE;
  for (i = 0; i < 24; i++)
    {
      if (!gtk_widget_is_sensitive (toggle[i]))
        continue;

      if (GTK_IS_RADIO_BUTTON (toggle[i]))
        {
          if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle[i])))
            {
              if (has_feature)
                g_string_append (s, ", ");
              g_string_append (s, gtk_buildable_get_name (GTK_BUILDABLE (toggle[i])));
              g_string_append (s, " 1");
              has_feature = TRUE;
            }
        }
      else
        {
          if (has_feature)
            g_string_append (s, ", ");
          g_string_append (s, gtk_buildable_get_name (GTK_BUILDABLE (toggle[i])));
          if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle[i])))
            g_string_append (s, " 1");
          else
            g_string_append (s, " 0");
          has_feature = TRUE;
        }
    }

  font_settings = g_string_free (s, FALSE);

  gtk_label_set_text (GTK_LABEL (settings), font_settings);

  s = g_string_new ("");
  g_string_append_printf (s, "<span font_desc='%s' font_features='%s'>%s</span>", font_desc, font_settings, text);

  gtk_label_set_markup (GTK_LABEL (label), s->str);

  g_string_free (s, TRUE);

  g_free (font_desc);
  g_free (font_settings);
}
コード例 #2
0
//Saving the actual image
G_MODULE_EXPORT void cb_save_clicked(GtkButton *button)
{

  //Check if there is an image
  if(camera_params.image_number==0)
  {
    gtk_widget_show( camera_params.objects->no_image_dialog );	
    return;
  }
  camera_params.wand_data.saving_wand=NULL;
  if(strcmp("processed_save_button",gtk_buildable_get_name(GTK_BUILDABLE(button)))==0)
  {
    pthread_mutex_lock(&camera_params.wand_data.processed_img_mutex);
    camera_params.wand_data.saving_wand=CloneMagickWand(camera_params.wand_data.processed_magick_wand);
    pthread_mutex_unlock(&camera_params.wand_data.processed_img_mutex);
  }
  else if(strcmp("raw_save_button",gtk_buildable_get_name(GTK_BUILDABLE(button)))==0)
  {
    pthread_mutex_lock(&camera_params.wand_data.raw_img_mutex);
    camera_params.wand_data.saving_wand=CloneMagickWand(camera_params.wand_data.raw_magick_wand);
    pthread_mutex_unlock(&camera_params.wand_data.raw_img_mutex);

    //we scale the image on 16 bits before saving
    imagemagick_levelimage(camera_params.wand_data.saving_wand, 0, 1<<((int)camera_params.sensorbits));
	
  }
  if(camera_params.wand_data.saving_wand)
  {
    gtk_widget_show( camera_params.objects->imagesavedialog );
    g_print("save button %s clicked\n",gtk_buildable_get_name(GTK_BUILDABLE(button)));      
  }
}
コード例 #3
0
//Directory chooser
G_MODULE_EXPORT void cb_choose_dir_clicked(GtkButton *button)
{
  if(strcmp("raw_select_dir",gtk_buildable_get_name(GTK_BUILDABLE(button)))==0)
    camera_params.wand_data.dirchoosing=DIR_CHOOSING_RAW;
  if(strcmp("processed_select_dir",gtk_buildable_get_name(GTK_BUILDABLE(button)))==0)
    camera_params.wand_data.dirchoosing=DIR_CHOOSING_PROCESSED;
  gtk_widget_show( camera_params.objects->directorychooserdialog );
}
コード例 #4
0
ファイル: glade-previewer.c プロジェクト: kugel-/glade
static gint
objects_cmp_func (gconstpointer a, gconstpointer b)
{
  const gchar *name_a, *name_b;
  name_a = gtk_buildable_get_name (GTK_BUILDABLE (a));
  name_b = gtk_buildable_get_name (GTK_BUILDABLE (b));
  return g_strcmp0 (name_a, name_b);
}
コード例 #5
0
ファイル: zoom-options.c プロジェクト: thisMagpie/GSoC
static void
tracking_radio_toggled_cb (GtkWidget *widget, ZoomOptionsPrivate *priv)
{
    if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)) == TRUE)
    {
    g_settings_set_string (priv->settings, "mouse-tracking",
                           gtk_buildable_get_name (GTK_BUILDABLE (widget)));   
    g_settings_set_string (priv->settings, "focus-tracking",
                               gtk_buildable_get_name (GTK_BUILDABLE (widget)));
    g_settings_set_string (priv->settings, "caret-tracking",
                               gtk_buildable_get_name (GTK_BUILDABLE (widget)));
    }
}
コード例 #6
0
ファイル: na-gtk-utils.c プロジェクト: nmbooker/caja-actions
/*
 * na_gtk_utils_find_widget_by_name:
 * @container: a #GtkContainer, usually the #GtkWindow toplevel.
 * @name: the name of the searched widget.
 *
 * Returns: the searched widget.
 */
GtkWidget *
na_gtk_utils_find_widget_by_name( GtkContainer *container, const gchar *name )
{
	GList *children = gtk_container_get_children( container );
	GList *ic;
	GtkWidget *found = NULL;
	GtkWidget *child;
	const gchar *child_name;

	for( ic = children ; ic && !found ; ic = ic->next ){

		if( GTK_IS_WIDGET( ic->data )){
			child = GTK_WIDGET( ic->data );
			child_name = gtk_buildable_get_name( GTK_BUILDABLE( child ));
			if( child_name && strlen( child_name ) && !g_ascii_strcasecmp( name, child_name )){
				found = child;
				break;
			}
			if( GTK_IS_CONTAINER( child )){
				found = na_gtk_utils_find_widget_by_name( GTK_CONTAINER( child ), name );
			}
		}
	}

	g_list_free( children );
	return( found );
}
コード例 #7
0
ファイル: gel-ui-utils.c プロジェクト: ldotlopez/eina
/**
 * gel_ui_container_find_widget:
 * @container: A #GtkContainer
 * @name: Child name
 *
 * Tries to find widget named @name in @container recursively. If it is not
 * found %NULL is returned. No references are added in this function.
 *
 * Returns: (transfer none) (allow-none): The widget
 */
GtkWidget *
gel_ui_container_find_widget(GtkContainer *container, const gchar *name)
{
	g_return_val_if_fail(GTK_IS_CONTAINER(container), NULL);
	g_return_val_if_fail(name, NULL);

	GtkWidget *ret = NULL;

	GList *children = gtk_container_get_children(container);
	GList *iter = children;
	while (iter && (ret == NULL))
	{
		GtkWidget *child = (GtkWidget *) iter->data;
		const gchar *c_name= gtk_buildable_get_name(GTK_BUILDABLE(child));

		if (c_name && g_str_equal(name, c_name))
		{
			ret = child;
			break;
		}

		if (GTK_IS_CONTAINER(child))
			ret = gel_ui_container_find_widget((GtkContainer *) child, name);

		iter = iter->next;
	}

	return ret;
}
コード例 #8
0
static const char *
get_name (AtkObject *accessible)
{
  char *name;

  name = g_object_get_data (G_OBJECT (accessible), "gtk-accessibility-dump-name");
  if (name)
    return name;

  if (GTK_IS_ACCESSIBLE (accessible))
    {
      GtkWidget *widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));

      name = g_strdup (gtk_buildable_get_name (GTK_BUILDABLE (widget)));
    }

  if (name == NULL && ATK_IS_TEXT (accessible))
    {
      name = atk_text_get_text (ATK_TEXT (accessible), 0, -1);
    }

  if (name == NULL)
    {
      /* Generate a unique, repeatable name */
      name = g_strdup_printf ("unnamed-%s-%d", G_OBJECT_TYPE_NAME (accessible), unnamed_object_count++);
    }

  g_object_set_data_full (G_OBJECT (accessible), "gtk-accessibility-dump-name", name, g_free);
  return name;
}
コード例 #9
0
ファイル: color.c プロジェクト: hjarmstrong/gnome-paint
gboolean 
on_color_palette_entry_button_press_event ( GtkWidget	   *widget, 
											GdkEventButton *event,
											gpointer       user_data )
{
	const gchar *name;
	guint i;
	name = gtk_buildable_get_name ( GTK_BUILDABLE (widget) );
	i = ( (guint)(name[0] - '0') * 10 ) + (guint)(name[1] - '0');
	
	if ( event->type == GDK_2BUTTON_PRESS )
	{
		palette_color_picker ( i );
	}
	if ( event->button == LEFT_BUTTON )
	{
		foreground_set_color_from_palette ( i );
		notify_brush_of_fg_color_change();
	}
	else if ( event->button == RIGHT_BUTTON )
	{
		background_set_color_from_palette ( i );
	}

	
	return TRUE;
}
コード例 #10
0
ファイル: gog-bubble-prefs.c プロジェクト: UIKit0/goffice
static void
cb_type_changed (GtkToggleButton* button, GObject *bubble)
{
	if (gtk_toggle_button_get_active (button))
		g_object_set (bubble, "size-as-area",
			strcmp (gtk_buildable_get_name (GTK_BUILDABLE (button)), "area")? FALSE: TRUE, NULL);
}
コード例 #11
0
static void
record_state_change (AtkObject   *accessible,
                     const gchar *state,
                     gboolean     set,
                     GString     *string)
{
  GtkWidget *w;
  const gchar *name;

  if (states)
    {
      gint i;

      for (i = 0; states[i]; i++)
        {
          if (strcmp (states[i], state) == 0)
            break;
        }
      if (states[i] == NULL)
        return;
    }

  w = gtk_accessible_get_widget (GTK_ACCESSIBLE (accessible));
  name = gtk_buildable_get_name (GTK_BUILDABLE (w));
  g_string_append_printf (string, "%s %s %d\n", name, state, set); 
}
コード例 #12
0
static void
list_box_row_activated (GtkListBox      *listbox,
                        GtkListBoxRow   *row,
                        CcDateTimePanel *self)

{
  CcDateTimePanelPrivate *priv = self->priv;
  gchar *widget_name, *found;

  widget_name = g_strdup (gtk_buildable_get_name (GTK_BUILDABLE (row)));

  if (!widget_name)
    return;

  gtk_list_box_select_row (listbox, NULL);

  if (!g_strcmp0 (widget_name, "auto-datetime-row"))
    {
      toggle_switch (W ("network_time_switch"));
    }
  else if (!g_strcmp0 (widget_name, "auto-timezone-row"))
    {
      toggle_switch (W ("auto_timezone_switch"));
    }
  else if ((found = g_strrstr (widget_name, "button")))
    {
      /* replace "button" with "dialog" */
      memcpy (found, "dialog", 6);

      run_dialog (self, widget_name);
    }

  g_free (widget_name);
}
コード例 #13
0
ファイル: na-gtk-utils.c プロジェクト: nmbooker/caja-actions
static void
dump_children( const gchar *thisfn, GtkContainer *container, int level )
{
	GList *children = gtk_container_get_children( container );
	GList *ic;
	GtkWidget *child;
	const gchar *child_name;
	GString *prefix;
	int i;

	prefix = g_string_new( "" );
	for( i = 0 ; i <= level ; ++i ){
		g_string_append_printf( prefix, "%s", "|  " );
	}

	for( ic = children ; ic ; ic = ic->next ){

		if( GTK_IS_WIDGET( ic->data )){
			child = GTK_WIDGET( ic->data );
			child_name = gtk_buildable_get_name( GTK_BUILDABLE( child ));
			g_debug( "%s: %s%s\t%p %s",
					thisfn, prefix->str, G_OBJECT_TYPE_NAME( child ), ( void * ) child, child_name );

			if( GTK_IS_CONTAINER( child )){
				dump_children( thisfn, GTK_CONTAINER( child ), level+1 );
			}
		}
	}

	g_list_free( children );
	g_string_free( prefix, TRUE );
}
コード例 #14
0
ファイル: gtkbuilderparser.c プロジェクト: endlessm/gtk
static void
subparser_end (GMarkupParseContext  *context,
               const gchar          *element_name,
               ParserData           *data,
               GError              **error)
{
  if (data->subparser->parser->end_element)
    data->subparser->parser->end_element (context, element_name,
                                          data->subparser->data, error);

  if (*error)
    return;

  if (strcmp (data->subparser->start, element_name) != 0)
    return;

  gtk_buildable_custom_tag_end (GTK_BUILDABLE (data->subparser->object),
                                data->builder,
                                data->subparser->child,
                                element_name,
                                data->subparser->data);
  g_free (data->subparser->parser);

  if (_gtk_builder_lookup_failed (data->builder, error))
    return;

  if (GTK_BUILDABLE_GET_IFACE (data->subparser->object)->custom_finished)
    data->custom_finalizers = g_slist_prepend (data->custom_finalizers,
                                               data->subparser);
  else
    free_subparser (data->subparser);

  data->subparser = NULL;
}
コード例 #15
0
ファイル: dialog-preferences.c プロジェクト: 814ckf0x/gnucash
/** This function builds a hash table of "interesting" widgets,
 *  i.e. widgets whose name starts with "pref/".  This table is
 *  needed to perform name->widget lookups when binding the widgets
 *  to their matching preferences.
 *
 *  @internal
 *
 *  @param builder A pointer to builder glade file currently being
 *  added to the dialog.
 *
 *  @param dialog A pointer to the dialog. The hash table is stored
 *  as a pointer off the dialog so that it can be found in the binding
 *  code. */
static void
gnc_prefs_build_widget_table (GtkBuilder *builder,
                              GtkWidget *dialog)
{
    GHashTable *prefs_table;
    GSList *interesting, *runner;
    const gchar *name;
    const gchar *wname;
    GtkWidget *widget;

    prefs_table = g_object_get_data(G_OBJECT(dialog), PREFS_WIDGET_HASH);

    interesting = gtk_builder_get_objects(builder);

    for (runner = interesting; runner; runner = g_slist_next(runner))
    {
        widget = runner->data;
        if (GTK_IS_WIDGET(widget))
        {
            wname = gtk_widget_get_name(widget);
            name = gtk_buildable_get_name(GTK_BUILDABLE(widget));
            DEBUG("Widget type is %s and buildable get name is %s", wname, name);
            if (g_str_has_prefix (name, "pref"))
                g_hash_table_insert(prefs_table, (gchar *)name, widget);
        }
    }
    g_slist_free(interesting);

}
コード例 #16
0
ファイル: helper.c プロジェクト: RobertDash/pspp
void
connect_help (GtkBuilder *xml)
{
  GSList *helps = gtk_builder_get_objects (xml);

  GSList *i;
  for ( i = helps; i ; i = g_slist_next (i))
    {
      GObject *o = i->data;
      if ( GTK_IS_WIDGET (o) )
	{
	  const gchar *name = gtk_buildable_get_name (GTK_BUILDABLE (o));
	  gchar s[12] = {0};

	  if ( name)
	    strncpy (s, name, 11);
	  s[11] = '\0';


	  if ( 0 == strcmp ("help_button", s))
	    {
	    g_signal_connect (o, "clicked", give_help, 0);
	    }
	}
    }

  g_slist_free (helps);
}
コード例 #17
0
static void
gtk_size_group_buildable_custom_finished (GtkBuildable  *buildable,
					  GtkBuilder    *builder,
					  GObject       *child,
					  const gchar   *tagname,
					  gpointer       user_data)
{
  GSList *l;
  GSListSubParserData *data;
  GObject *object;

  if (strcmp (tagname, "widgets"))
    return;
  
  data = (GSListSubParserData*)user_data;
  data->items = g_slist_reverse (data->items);

  for (l = data->items; l; l = l->next)
    {
      object = gtk_builder_get_object (builder, l->data);
      if (!object)
	{
	  g_warning ("Unknown object %s specified in sizegroup %s",
		     (const gchar*)l->data,
		     gtk_buildable_get_name (GTK_BUILDABLE (data->object)));
	  continue;
	}
      gtk_size_group_add_widget (GTK_SIZE_GROUP (data->object),
				 GTK_WIDGET (object));
      g_free (l->data);
    }
  g_slist_free (data->items);
  g_slice_free (GSListSubParserData, data);
}
コード例 #18
0
ファイル: gtk_preferences.cpp プロジェクト: chuckries/snes9x
static void
event_control_toggle (GtkToggleButton *widget, gpointer data)
{
    Snes9xPreferences    *window = (Snes9xPreferences *) data;
    static unsigned char toggle_lock = 0;
    const gchar          *name;
    bool                 state;

    if (toggle_lock)
    {
        return;
    }

    window->last_toggled = widget;
    name = gtk_buildable_get_name (GTK_BUILDABLE (widget));
    state = gtk_toggle_button_get_active (widget);

    toggle_lock = 1;

    for (int i = 0; b_links[i].button_name; i++)
    {
        if (strcasecmp (name, b_links[i].button_name))
        {
            gtk_toggle_button_set_active (
                GTK_TOGGLE_BUTTON (window->get_widget (b_links[i].button_name)),
                FALSE);
        }
    }

    gtk_toggle_button_set_active (widget, state);

    toggle_lock = 0;

    return;
}
コード例 #19
0
static void
cc_sharing_panel_main_list_box_row_activated (GtkListBox     *listbox,
                                              GtkListBoxRow  *row,
                                              CcSharingPanel *self)
{
  gchar *widget_name, *found;

  widget_name = g_strdup (gtk_buildable_get_name (GTK_BUILDABLE (row)));

  if (!widget_name)
    return;

  gtk_list_box_select_row (listbox, NULL);

  /* replace "button" with "dialog" */
  found = g_strrstr (widget_name, "button");

  if (!found)
    goto out;

  memcpy (found, "dialog", 6);

  cc_sharing_panel_run_dialog (self, widget_name);

out:
  g_free (widget_name);
}
コード例 #20
0
/* When Modulation Select changed, show relevant modulation routing */
gboolean
on_Modulation_Select_changed(GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
  struct match match;
  const char *id = gtk_buildable_get_name(GTK_BUILDABLE(widget));
  if (!id) return;
  if (!GTK_IS_COMBO_BOX(widget)) return;
  int select = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));

  /* Now mangle parameter name (= widget id) to something matchable */
  /* The name of our widget is something like "Modulation Select", whereas
   * the names of the widgets we want to hide/show are like
   * "Modulation 1 Amount". So we grab 'Modulation' and use it to match
   * against the child widgets to see which ones are interesting at all
   * (several of them will be things like labels etc), and use
   * the value of the combobox to match the actual Modulation route number. */

  /* We generate a 'prefix' string which is the first word of the
   * parameter, including the following space, e.g. "Modulation ". */

  /* Need to make copy of string in order to modify it. */
  char prefix[strlen(id) + 1];
  strcpy(prefix, id);
  /* Find end of first word, normally Modulation */
  char *find = prefix;
  while (*find && *find++ != ' ')
    ;
  if (!*find) return; /* end of string found before end of first word,
                         or no suffix, i.e. id is just "Modulation " */
  *find = '\0'; /* terminate it: we now have "Modulation " */

  match.prefix = prefix;
  match.select = select + 1; /* Assume routes start at 1, i.e. "Modulation 1" */

  /* Now show/hide all children of parent container: Show the parameter
   * with matching (first part of) name and number, and hide the others. */

  /* Actually, we cheat a bit here, we just scan all children of the
   * immediate parent, which is fine for the modulation where all the
   * step widgets are in the same box; on a more global scale we'd have
   * to start at the top window, and recursively scan every container we
   * find. However, since we have two modulation routings, we couldn't go
   * that high in the object hierarchy, or we would show/hide the routings
   * for both modulation boxes. */
  GtkWidget *container = gtk_widget_get_parent(GTK_WIDGET(widget));
  GList *container_children = gtk_container_get_children(GTK_CONTAINER(container));

  g_list_foreach(container_children, show_hide, &match);

  /* Finally, any knob mappings related to the modulation selected must be
   * redone to correspond with the mappings now visible. */
  invalidate_knob_mappings(container);

  return FALSE;
}
コード例 #21
0
static void
print_knobmap(struct knobmap *knobmap)
{
  if (debug) {
    printf("Frame %s: Knobs:\n",
           gtk_buildable_get_name(GTK_BUILDABLE(knobmap->container)));
    g_list_foreach(knobmap->pots.active, print_knob, NULL);
    printf("Buttons:\n");
    g_list_foreach(knobmap->buttons.active, print_knob, NULL);
  }
}
コード例 #22
0
ファイル: dialog-bi-import-gui.c プロジェクト: 573/gnucash
void gnc_bi_import_gui_open_mode_cb (GtkWidget *widget, gpointer data)
{
    BillImportGui *gui = data;
    const gchar *name;
    name = gtk_buildable_get_name(GTK_BUILDABLE(widget));
    if (!gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(widget) ))
        return;
    if  (g_ascii_strcasecmp(name, "radiobuttonOpenAll") == 0)gui->open_mode = "ALL";
    else if (g_ascii_strcasecmp(name, "radiobuttonOpenNotPosted") == 0)gui->open_mode = "NOT_POSTED";
    else if (g_ascii_strcasecmp(name, "radiobuttonOpenNone") == 0)gui->open_mode = "NONE";
}
コード例 #23
0
static void
print_knob(gpointer data, gpointer user_data)
{
  struct knob_descriptor *knob_description = data;
  GtkWidget *widget = knob_description->widget;
  GtkAllocation allocation;
  gtk_widget_get_allocation(widget, &allocation);
  printf("Widget %s:%s (%d,%d): %s\n",
         gtk_widget_get_name(widget), gtk_buildable_get_name(GTK_BUILDABLE(widget)),
         allocation.x, allocation.y,
         gtk_widget_get_visible(widget) ? "visible" : "hidden");
}
コード例 #24
0
ファイル: capplet.c プロジェクト: iperry/roxterm
void on_float_range_changed(GtkRange * range, CappletData *capp)
{
    const char *name;

    if (capplet_ignore_changes)
        return;
    name = gtk_buildable_get_name(GTK_BUILDABLE(range));
    if (name)
    {
        capplet_set_float(capp->options, name, gtk_range_get_value(range));
    }
}
コード例 #25
0
ファイル: dialog-bi-import-gui.c プロジェクト: 573/gnucash
/*****************************************************************
 * Set whether we are importing a bi, invoice, Customer or Vendor
 * ****************************************************************/
void gnc_import_gui_type_cb (GtkWidget *widget, gpointer data)
{
    BillImportGui *gui = data;
    const gchar *name;
    name = gtk_buildable_get_name(GTK_BUILDABLE(widget));
    if (!gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(widget) ))
        return;
    if  (g_ascii_strcasecmp(name, "radiobuttonInvoice") == 0)gui->type = "INVOICE";
    else if (g_ascii_strcasecmp(name, "radiobuttonBill") == 0)gui->type = "BILL";
    //printf ("TYPE set to, %s\n",gui->type);

}
コード例 #26
0
ファイル: capplet.c プロジェクト: iperry/roxterm
void on_combo_changed(GtkComboBox * combo, CappletData *capp)
{
    const char *name;

    if (capplet_ignore_changes)
        return;
    name = gtk_buildable_get_name(GTK_BUILDABLE(combo));
    if (name)
    {
        capplet_set_int(capp->options, name,
                gtk_combo_box_get_active(combo));
    }
}
コード例 #27
0
ファイル: capplet.c プロジェクト: iperry/roxterm
void on_spin_button_changed(GtkSpinButton * button, CappletData *capp)
{
    const char *name;

    if (capplet_ignore_changes)
        return;
    name = gtk_buildable_get_name(GTK_BUILDABLE(button));
    if (name)
    {
        capplet_set_int(capp->options, name,
                gtk_spin_button_get_value_as_int(button));
    }
}
コード例 #28
0
/** Connect a GtkSpinButton widget to its stored value in the preferences database.
 *
 *  @internal
 *
 *  @param button A pointer to the spin button that should be
 *  connected.
 */
static void
gnc_prefs_connect_spin_button (GtkSpinButton *spin)
{
    gchar *group, *pref;

    g_return_if_fail(GTK_IS_SPIN_BUTTON(spin));

    gnc_prefs_split_widget_name (gtk_buildable_get_name(GTK_BUILDABLE(spin)), &group, &pref);

    gnc_prefs_bind (group, pref, G_OBJECT (spin), "value");

    g_free (group);
    g_free (pref);
}
コード例 #29
0
/** Connect a GtkEntry widget to its stored value in the preferences database.
 *
 *  @internal
 *
 *  @param entry A pointer to the entry that should be connected.
 */
static void
gnc_prefs_connect_entry (GtkEntry *entry)
{
    gchar *group, *pref;

    g_return_if_fail(GTK_IS_ENTRY(entry));

    gnc_prefs_split_widget_name (gtk_buildable_get_name(GTK_BUILDABLE(entry)), &group, &pref);

    gnc_prefs_bind (group, pref, G_OBJECT (entry), "text");

    g_free (group);
    g_free (pref);
}
コード例 #30
0
/** Connect a GtkComboBox widget to its stored value in the preferences database.
 *
 *  @internal
 *
 *  @param box A pointer to the combo box that should be connected.
 */
static void
gnc_prefs_connect_combo_box (GtkComboBox *box)
{
    gchar *group, *pref;

    g_return_if_fail(GTK_IS_COMBO_BOX(box));

    gnc_prefs_split_widget_name (gtk_buildable_get_name(GTK_BUILDABLE(box)), &group, &pref);

    gnc_prefs_bind (group, pref, G_OBJECT (box), "active");

    g_free (group);
    g_free (pref);
}