本文整理匯總了C++中GTK_BUILDABLE函數的典型用法代碼示例。如果您正苦於以下問題:C++ GTK_BUILDABLE函數的具體用法?C++ GTK_BUILDABLE怎麽用?C++ GTK_BUILDABLE使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GTK_BUILDABLE函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: update
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: cb_save_clicked
//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: cb_choose_dir_clicked
//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: objects_cmp_func
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: tracking_radio_toggled_cb
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: na_gtk_utils_find_widget_by_name
/*
* 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: gel_ui_container_find_widget
/**
* 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: on_color_palette_entry_button_press_event
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;
}
示例9: cb_type_changed
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);
}
示例10: record_state_change
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);
}
示例11: list_box_row_activated
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);
}
示例12: dump_children
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 );
}
示例13: subparser_end
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;
}
示例14: gnc_prefs_build_widget_table
/** 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);
}
示例15: connect_help
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);
}