本文整理汇总了C++中GTK_BUILDABLE函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_BUILDABLE函数的具体用法?C++ GTK_BUILDABLE怎么用?C++ GTK_BUILDABLE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_BUILDABLE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:Distrotech,项目名称:gtk,代码行数:60,代码来源:font_features.c
示例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)));
}
}
开发者ID:braice,项目名称:Camera-interface,代码行数:33,代码来源:camera_interface.c
示例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 );
}
开发者ID:braice,项目名称:Camera-interface,代码行数:9,代码来源:camera_interface.c
示例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);
}
开发者ID:kugel-,项目名称:glade,代码行数:8,代码来源:glade-previewer.c
示例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)));
}
}
开发者ID:thisMagpie,项目名称:GSoC,代码行数:13,代码来源:zoom-options.c
示例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 );
}
开发者ID:nmbooker,项目名称:caja-actions,代码行数:34,代码来源:na-gtk-utils.c
示例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;
}
开发者ID:ldotlopez,项目名称:eina,代码行数:39,代码来源:gel-ui-utils.c
示例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;
}
开发者ID:hjarmstrong,项目名称:gnome-paint,代码行数:27,代码来源:color.c
示例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);
}
开发者ID:UIKit0,项目名称:goffice,代码行数:7,代码来源:gog-bubble-prefs.c
示例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);
}
开发者ID:ConfusedReality,项目名称:pkg_toolkit_gtk3,代码行数:26,代码来源:state-record.c
示例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);
}
开发者ID:endlessm,项目名称:gnome-control-center,代码行数:34,代码来源:cc-datetime-panel.c
示例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 );
}
开发者ID:nmbooker,项目名称:caja-actions,代码行数:32,代码来源:na-gtk-utils.c
示例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;
}
开发者ID:endlessm,项目名称:gtk,代码行数:34,代码来源:gtkbuilderparser.c
示例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);
}
开发者ID:814ckf0x,项目名称:gnucash,代码行数:42,代码来源:dialog-preferences.c
示例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);
}
开发者ID:RobertDash,项目名称:pspp,代码行数:28,代码来源:helper.c
示例16: event_control_toggle
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;
}
开发者ID:chuckries,项目名称:snes9x,代码行数:35,代码来源:gtk_preferences.cpp
示例17: cc_sharing_panel_main_list_box_row_activated
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);
}
开发者ID:1dot75cm,项目名称:gnome-control-center,代码行数:27,代码来源:cc-sharing-panel.c
示例18: gnc_bi_import_gui_open_mode_cb
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";
}
开发者ID:573,项目名称:gnucash,代码行数:11,代码来源:dialog-bi-import-gui.c
示例19: on_float_range_changed
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));
}
}
开发者ID:iperry,项目名称:roxterm,代码行数:12,代码来源:capplet.c
示例20: gnc_import_gui_type_cb
/*****************************************************************
* 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);
}
开发者ID:573,项目名称:gnucash,代码行数:15,代码来源:dialog-bi-import-gui.c
注:本文中的GTK_BUILDABLE函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论