本文整理汇总了C++中GTK_BUTTON函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_BUTTON函数的具体用法?C++ GTK_BUTTON怎么用?C++ GTK_BUTTON使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_BUTTON函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: _set_playPauseImage
static void _set_playPauseImage (CustomData *data, const gchar *stockid) {
gtk_image_set_from_stock(
GTK_IMAGE (gtk_button_get_image (GTK_BUTTON (data->playPauseButton))),
stockid, GTK_ICON_SIZE_BUTTON);
}
开发者ID:adiknoth,项目名称:4deckradio,代码行数:5,代码来源:mygstreamer.c
示例2: fc_malloc
/****************************************************************
Worklist editor shell.
*****************************************************************/
GtkWidget *create_worklist(void)
{
GtkWidget *editor, *table, *sw, *bbox;
GtkWidget *src_view, *dst_view, *label, *button;
GtkWidget *menubar, *item, *menu, *image;
GtkWidget *table2, *arrow, *check;
GtkSizeGroup *group;
GtkListStore *src_store, *dst_store;
struct worklist_data *ptr;
ptr = fc_malloc(sizeof(*ptr));
src_store = gtk_list_store_new(1, G_TYPE_INT);
dst_store = gtk_list_store_new(1, G_TYPE_INT);
ptr->global_worklist_id = -1;
ptr->pcity = NULL;
ptr->src = src_store;
ptr->dst = dst_store;
ptr->future = FALSE;
/* create shell. */
editor = gtk_grid_new();
gtk_grid_set_row_spacing(GTK_GRID(editor), 6);
gtk_orientable_set_orientation(GTK_ORIENTABLE(editor),
GTK_ORIENTATION_VERTICAL);
g_signal_connect(editor, "destroy", G_CALLBACK(worklist_destroy), ptr);
g_object_set_data(G_OBJECT(editor), "data", ptr);
ptr->editor = editor;
/* add source and target lists. */
table = gtk_grid_new();
gtk_container_add(GTK_CONTAINER(editor), table);
group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
sw = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
GTK_SHADOW_ETCHED_IN);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_grid_attach(GTK_GRID(table), sw, 3, 1, 2, 1);
src_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(src_store));
gtk_widget_set_hexpand(src_view, TRUE);
gtk_widget_set_vexpand(src_view, TRUE);
g_object_unref(src_store);
gtk_size_group_add_widget(group, src_view);
gtk_widget_set_name(src_view, "small_font");
populate_view(GTK_TREE_VIEW(src_view), &ptr->pcity, &ptr->src_col);
gtk_container_add(GTK_CONTAINER(sw), src_view);
label = g_object_new(GTK_TYPE_LABEL,
"use-underline", TRUE,
"mnemonic-widget", src_view,
"label", _("Source _Tasks:"),
"xalign", 0.0, "yalign", 0.5, NULL);
gtk_grid_attach(GTK_GRID(table), label, 3, 0, 1, 1);
check = gtk_check_button_new_with_mnemonic(_("Show _Future Targets"));
gtk_grid_attach(GTK_GRID(table), check, 4, 0, 1, 1);
g_signal_connect(check, "toggled", G_CALLBACK(future_callback), ptr);
table2 = gtk_grid_new();
gtk_grid_attach(GTK_GRID(table), table2, 2, 1, 1, 1);
button = gtk_button_new();
gtk_widget_set_margin_top(button, 24);
gtk_widget_set_margin_bottom(button, 24);
ptr->prepend_cmd = button;
gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
gtk_grid_attach(GTK_GRID(table2), button, 0, 0, 1, 1);
arrow = gtk_arrow_new(GTK_ARROW_LEFT, GTK_SHADOW_NONE);
gtk_container_add(GTK_CONTAINER(button), arrow);
g_signal_connect_swapped(button, "clicked",
G_CALLBACK(queue_prepend), ptr);
gtk_widget_set_sensitive(ptr->prepend_cmd, FALSE);
button = gtk_button_new();
ptr->up_cmd = button;
gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
gtk_grid_attach(GTK_GRID(table2), button, 0, 1, 1, 1);
arrow = gtk_arrow_new(GTK_ARROW_UP, GTK_SHADOW_NONE);
gtk_container_add(GTK_CONTAINER(button), arrow);
g_signal_connect_swapped(button, "clicked",
G_CALLBACK(queue_bubble_up), ptr);
gtk_widget_set_sensitive(ptr->up_cmd, FALSE);
button = gtk_button_new();
ptr->down_cmd = button;
gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
//.........这里部分代码省略.........
开发者ID:jheusala,项目名称:freeciv,代码行数:101,代码来源:wldlg.c
示例3: caja_x_content_bar_set_x_content_type
void
caja_x_content_bar_set_x_content_type (CajaXContentBar *bar, const char *x_content_type)
{
char *message;
char *description;
GAppInfo *default_app;
g_free (bar->priv->x_content_type);
bar->priv->x_content_type = g_strdup (x_content_type);
description = g_content_type_get_description (x_content_type);
/* Customize greeting for well-known x-content types */
if (strcmp (x_content_type, "x-content/audio-cdda") == 0)
{
message = g_strdup (_("These files are on an Audio CD."));
}
else if (strcmp (x_content_type, "x-content/audio-dvd") == 0)
{
message = g_strdup (_("These files are on an Audio DVD."));
}
else if (strcmp (x_content_type, "x-content/video-dvd") == 0)
{
message = g_strdup (_("These files are on a Video DVD."));
}
else if (strcmp (x_content_type, "x-content/video-vcd") == 0)
{
message = g_strdup (_("These files are on a Video CD."));
}
else if (strcmp (x_content_type, "x-content/video-svcd") == 0)
{
message = g_strdup (_("These files are on a Super Video CD."));
}
else if (strcmp (x_content_type, "x-content/image-photocd") == 0)
{
message = g_strdup (_("These files are on a Photo CD."));
}
else if (strcmp (x_content_type, "x-content/image-picturecd") == 0)
{
message = g_strdup (_("These files are on a Picture CD."));
}
else if (strcmp (x_content_type, "x-content/image-dcf") == 0)
{
message = g_strdup (_("The media contains digital photos."));
}
else if (strcmp (x_content_type, "x-content/audio-player") == 0)
{
message = g_strdup (_("These files are on a digital audio player."));
}
else if (strcmp (x_content_type, "x-content/software") == 0)
{
message = g_strdup (_("The media contains software."));
}
else
{
/* fallback to generic greeting */
message = g_strdup_printf (_("The media has been detected as \"%s\"."), description);
}
gtk_label_set_text (GTK_LABEL (bar->priv->label), message);
gtk_widget_show (bar->priv->label);
/* TODO: We really need a GtkBrowserBackButton-ish widget here.. until then, we only
* show the default application. */
default_app = g_app_info_get_default_for_type (x_content_type, FALSE);
if (default_app != NULL)
{
char *button_text;
const char *name;
GIcon *icon;
GtkWidget *image;
icon = g_app_info_get_icon (default_app);
if (icon != NULL)
{
GdkPixbuf *pixbuf;
int icon_size;
CajaIconInfo *icon_info;
icon_size = caja_get_icon_size_for_stock_size (GTK_ICON_SIZE_BUTTON);
icon_info = caja_icon_info_lookup (icon, icon_size);
pixbuf = caja_icon_info_get_pixbuf_at_size (icon_info, icon_size);
image = gtk_image_new_from_pixbuf (pixbuf);
g_object_unref (pixbuf);
g_object_unref (icon_info);
}
else
{
image = NULL;
}
name = g_app_info_get_display_name (default_app);
button_text = g_strdup_printf (_("Open %s"), name);
gtk_button_set_image (GTK_BUTTON (bar->priv->button), image);
gtk_button_set_label (GTK_BUTTON (bar->priv->button), button_text);
gtk_widget_show (bar->priv->button);
g_free (button_text);
g_object_unref (default_app);
//.........这里部分代码省略.........
开发者ID:eyelash,项目名称:caja,代码行数:101,代码来源:caja-x-content-bar.c
示例4: gui_init
//.........这里部分代码省略.........
if(dir)
{
while((d_name = g_dir_read_name(dir)))
{
snprintf(filename, DT_MAX_PATH_LEN, "%s/%s", dirname, d_name);
tmpprof = cmsOpenProfileFromFile(filename, "r");
if(tmpprof)
{
char *lang = getenv("LANG");
if (!lang) lang = "en_US";
dt_lib_export_profile_t *prof = (dt_lib_export_profile_t *)g_malloc0(sizeof(dt_lib_export_profile_t));
char name[1024];
cmsGetProfileInfoASCII(tmpprof, cmsInfoDescription, lang, lang+3, name, 1024);
g_strlcpy(prof->name, name, sizeof(prof->name));
g_strlcpy(prof->filename, d_name, sizeof(prof->filename));
prof->pos = ++pos;
cmsCloseProfile(tmpprof);
d->profiles = g_list_append(d->profiles, prof);
}
}
g_dir_close(dir);
}
GList *l = d->profiles;
label = gtk_label_new(_("profile"));
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
gtk_table_attach(GTK_TABLE(self->widget), label, 0, 1, 9, 10, GTK_EXPAND|GTK_FILL, 0, 0, 0);
d->profile = GTK_COMBO_BOX(gtk_combo_box_new_text());
dt_ellipsize_combo(d->profile);
gtk_table_attach(GTK_TABLE(self->widget), GTK_WIDGET(d->profile), 1, 2, 9, 10, GTK_SHRINK|GTK_EXPAND|GTK_FILL, 0, 0, 0);
// gtk_table_attach(GTK_TABLE(self->widget), GTK_WIDGET(d->profile), 1, 2, 9, 10, GTK_EXPAND|GTK_FILL, 0, 0, 0);
gtk_combo_box_append_text(d->profile, _("image settings"));
while(l)
{
dt_lib_export_profile_t *prof = (dt_lib_export_profile_t *)l->data;
if(!strcmp(prof->name, "X profile"))
gtk_combo_box_append_text(d->profile, _("system display profile"));
else
gtk_combo_box_append_text(d->profile, prof->name);
l = g_list_next(l);
}
gtk_combo_box_set_active(d->profile, 0);
char tooltip[1024];
snprintf(tooltip, 1024, _("output icc profiles in %s/color/out or %s/color/out"), confdir, datadir);
g_object_set(G_OBJECT(d->profile), "tooltip-text", tooltip, (char *)NULL);
// Add style combo
label = gtk_label_new(_("style"));
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
gtk_table_attach(GTK_TABLE(self->widget), label, 0, 1, 10, 11, GTK_EXPAND|GTK_FILL, 0, 0, 0);
d->style = GTK_COMBO_BOX(gtk_combo_box_new_text());
dt_ellipsize_combo(d->style);
gtk_combo_box_append_text(d->style, _("none"));
GList *styles = dt_styles_get_list("");
while (styles)
{
dt_style_t *style=(dt_style_t *)styles->data;
gtk_combo_box_append_text(d->style, style->name);
styles=g_list_next(styles);
}
gtk_table_attach(GTK_TABLE(self->widget), GTK_WIDGET(d->style), 1, 2, 10, 11, GTK_EXPAND|GTK_FILL, 0, 0, 0);
g_object_set(G_OBJECT(d->style), "tooltip-text", _("temporary style to append while exporting"), (char *)NULL);
// Set callback signals
g_signal_connect (G_OBJECT (d->intent), "changed",
G_CALLBACK (intent_changed),
(gpointer)d);
g_signal_connect (G_OBJECT (d->profile), "changed",
G_CALLBACK (profile_changed),
(gpointer)d);
g_signal_connect (G_OBJECT (d->style), "changed",
G_CALLBACK (style_changed),
(gpointer)d);
// Export button
GtkButton *button = GTK_BUTTON(gtk_button_new_with_label(_("export")));
d->export_button = button;
g_object_set(G_OBJECT(button), "tooltip-text", _("export with current settings (ctrl-e)"), (char *)NULL);
gtk_table_attach(GTK_TABLE(self->widget), GTK_WIDGET(button), 1, 2, 11, 12, GTK_EXPAND|GTK_FILL, 0, 0, 0);
g_signal_connect (G_OBJECT (button), "clicked",
G_CALLBACK (export_button_clicked),
(gpointer)self);
g_signal_connect (G_OBJECT (d->width), "value-changed",
G_CALLBACK (width_changed),
(gpointer)0);
g_signal_connect (G_OBJECT (d->height), "value-changed",
G_CALLBACK (height_changed),
(gpointer)0);
self->gui_reset(self);
}
开发者ID:julianjm,项目名称:darktable,代码行数:101,代码来源:export.c
示例5: s_typeslist_changed
static void
s_typeslist_changed (GtkWidget *w, gpointer d)
{
AP_UnixDialog_Styles * dlg = static_cast <AP_UnixDialog_Styles *>(d);
dlg->event_ListClicked (gtk_button_get_label (GTK_BUTTON(w)));
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:6,代码来源:ap_UnixDialog_Styles.cpp
示例6: wibuti_prefs_init
static void wibuti_prefs_init(WibutiPrefs *self) {
GError *err = NULL;
char *markup = "";
GtkBox *main_box = GTK_BOX(gtk_vbox_new(FALSE, 5));
GtkNotebook *notebook = GTK_NOTEBOOK(gtk_notebook_new());
GtkButton *btn_close = GTK_BUTTON(gtk_button_new_from_stock(GTK_STOCK_CLOSE));
GtkButtonBox *btnbox = GTK_BUTTON_BOX(gtk_hbutton_box_new());
GtkLabel *label_layout_tip = GTK_LABEL(gtk_label_new(""));
self->builder = gtk_builder_new();
#ifdef WIBUTI_WITH_BUTTONS
GtkAlignment *alignment_theme, *alignment_buttons;
GtkLabel *label_theme, *label_buttons;
gtk_builder_add_from_file(self->builder, WIBUTI_PATH_BUTTONS_UI, &err);
if (err != NULL) {
g_fprintf(stderr, "%s\n", err->message);
g_error_free(err);
} else {
alignment_theme = GTK_ALIGNMENT(gtk_builder_get_object(self->builder, "alignment_theme"));
alignment_buttons = GTK_ALIGNMENT(gtk_builder_get_object(self->builder, "alignment_buttons"));
self->combo_theme = GTK_COMBO_BOX(gtk_builder_get_object(self->builder, CFG_THEME));
self->chkb_hover_effect = GTK_TOGGLE_BUTTON(gtk_builder_get_object(self->builder, CFG_HOVER_EFFECT));
self->chkb_click_effect = GTK_TOGGLE_BUTTON(gtk_builder_get_object(self->builder, CFG_CLICK_EFFECT));
// fill themes combo
GtkListStore *list_store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
GtkCellRenderer *renderer = gtk_cell_renderer_text_new();
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(self->combo_theme), renderer, TRUE);
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(self->combo_theme), renderer, "text", 0, NULL);
gtk_combo_box_set_model(self->combo_theme, GTK_TREE_MODEL(list_store));
const gchar *subdir;
GDir *dir = g_dir_open(WIBUTI_PATH_THEMES, 0, NULL);
while ((subdir = g_dir_read_name(dir)) != NULL) {
GtkTreeIter iter;
gtk_list_store_append(list_store, &iter);
gtk_list_store_set(list_store, &iter, 0, subdir, 1, 0, -1);
}
g_dir_close(dir);
// pack to notebook
label_theme = GTK_LABEL(gtk_label_new("Themes"));
gtk_notebook_append_page(notebook, GTK_WIDGET(alignment_theme), GTK_WIDGET(label_theme));
label_buttons = GTK_LABEL(gtk_label_new("Buttons"));
gtk_notebook_append_page(notebook, GTK_WIDGET(alignment_buttons), GTK_WIDGET(label_buttons));
markup = g_strconcat(markup, "<b>M</b> - ", "minimize", "\n<b>R</b> - ", "maximize/restore",
"\n<b>X</b> - ", "close", "\n", NULL);
}
#endif // WIBUTI_WITH_BUTTONS
#ifdef WIBUTI_WITH_TITLE
GtkAlignment *alignment_title;
GtkLabel *label_title;
gtk_builder_add_from_file(self->builder, WIBUTI_PATH_TITLE_UI, &err);
if (err != NULL) {
g_fprintf(stderr, "%s\n", err->message);
g_error_free(err);
} else {
alignment_title = GTK_ALIGNMENT(gtk_builder_get_object(self->builder, "alignment_title"));
self->chkb_expand_title = GTK_TOGGLE_BUTTON(gtk_builder_get_object(self->builder, CFG_EXPAND_TITLE));
self->chkb_custom_style = GTK_TOGGLE_BUTTON(gtk_builder_get_object(self->builder, CFG_CUSTOM_STYLE));
self->btn_font_active = GTK_FONT_BUTTON(gtk_builder_get_object(self->builder, "btn_font_active"));
self->btn_font_inactive = GTK_FONT_BUTTON(gtk_builder_get_object(self->builder, "btn_font_inactive"));
self->btn_color_active = GTK_COLOR_BUTTON(gtk_builder_get_object(self->builder, "btn_color_active"));
self->btn_color_inactive = GTK_COLOR_BUTTON(gtk_builder_get_object(self->builder, "btn_color_inactive"));
self->scale_alignment = GTK_SCALE(gtk_builder_get_object(self->builder, "scale_alignment"));
// pack to notebook
label_title = GTK_LABEL(gtk_label_new("Title"));
gtk_notebook_append_page(notebook, GTK_WIDGET(alignment_title), GTK_WIDGET(label_title));
markup = g_strconcat(markup, "<b>I</b> - ", "icon", "\n<b>T</b> - ", "title", "\n", NULL);
}
#endif // WIBUTI_WITH_TITLE
GtkAlignment *alignment_general;
GtkLabel *label_general;
gtk_builder_add_from_file(self->builder, WIBUTI_PATH_GENERAL_UI, &err);
if (err != NULL) {
g_fprintf(stderr, "%s\n", err->message);
g_error_free(err);
} else {
alignment_general = GTK_ALIGNMENT(gtk_builder_get_object(self->builder, "alignment_general"));
label_layout_tip = GTK_LABEL(gtk_builder_get_object(self->builder, "label_layout_tip"));
self->chkb_only_maximized = GTK_TOGGLE_BUTTON(gtk_builder_get_object(self->builder, CFG_ONLY_MAXIMIZED));
self->chkb_hide_unmaximized = GTK_TOGGLE_BUTTON(gtk_builder_get_object(self->builder, CFG_HIDE_ON_UNMAXIMIZED));
self->btn_reload_layout = GTK_BUTTON(gtk_builder_get_object(self->builder, "btn_reload_layout"));
self->entry_layout = GTK_ENTRY(gtk_builder_get_object(self->builder, "entry_layout"));
// pack to notebook
//.........这里部分代码省略.........
开发者ID:coldreath,项目名称:window-applets,代码行数:101,代码来源:preferences.c
示例7: append_widget
static void
append_widget(GtkTreeStore *model,
GtkWidget *widget,
GtkTreeIter *parent_iter)
{
GtkTreeIter iter;
const char *class_name = G_OBJECT_CLASS_NAME(GTK_WIDGET_GET_CLASS(widget));
const char *name;
char *row_color = NULL;
char *window_info;
char *address;
gboolean realized;
gboolean mapped;
gboolean visible;
GList *l;
name = gtk_widget_get_name(widget);
if (name == NULL || strcmp(name, class_name) == 0) {
if (GTK_IS_LABEL(widget))
{
name = gtk_label_get_text(GTK_LABEL(widget));
}
else if (GTK_IS_BUTTON(widget))
{
name = gtk_button_get_label(GTK_BUTTON(widget));
}
else if (GTK_IS_WINDOW(widget))
{
name = gtk_window_get_title(GTK_WINDOW(widget));
}
else
{
name = "";
}
}
if (gtk_widget_get_window(widget))
{
#if HAVE_X11
window_info = g_strdup_printf("%p (XID 0x%x)", widget->window,
(int)GDK_WINDOW_XID(widget->window));
#else
window_info = g_strdup("");
#endif
}
else
{
window_info = g_strdup("");
}
address = g_strdup_printf("%p", widget);
realized = gtk_widget_get_realized(widget);
mapped = gtk_widget_get_mapped(widget);
visible = gtk_widget_get_visible(widget);
if (!realized || !mapped || !visible)
{
GtkStyle* style = gtk_widget_get_style(GTK_WIDGET(widget));
GdkColor color = style->fg[GTK_STATE_INSENSITIVE];
row_color = gdk_color_to_string(&color);
}
gtk_tree_store_append(model, &iter, parent_iter);
gtk_tree_store_set(model, &iter,
WIDGET, widget,
WIDGET_TYPE, class_name,
WIDGET_NAME, name,
WIDGET_REALIZED, realized,
WIDGET_MAPPED, mapped,
WIDGET_VISIBLE, visible,
WIDGET_WINDOW, window_info,
WIDGET_ADDRESS, address,
ROW_COLOR, row_color,
-1);
g_free(window_info);
g_free(address);
g_free(row_color);
if (GTK_IS_CONTAINER(widget))
{
GList* children = NULL;
/* Pick up all children, including those that are internal. */
gtk_container_forall(GTK_CONTAINER(widget),
on_container_forall, &children);
for (l = children; l != NULL; l = l->next)
{
append_widget(model, GTK_WIDGET(l->data), &iter);
}
g_list_free(children);
}
}
开发者ID:jwendell,项目名称:gtkparasite,代码行数:97,代码来源:widget-tree.c
示例8: gui_init
/* construct widget above */
void gui_init(struct dt_imageio_module_storage_t *self)
{
self->gui_data = g_malloc0(sizeof(dt_storage_facebook_gui_data_t));
dt_storage_facebook_gui_data_t *ui = self->gui_data;
ui->facebook_api = fb_api_init();
self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
// create labels
ui->label_album_title = GTK_LABEL(gtk_label_new(_("title")));
ui->label_album_summary = GTK_LABEL(gtk_label_new(_("summary")));
ui->label_album_privacy = GTK_LABEL(gtk_label_new(_("privacy")));
ui->label_status = GTK_LABEL(gtk_label_new(NULL));
gtk_widget_set_halign(GTK_WIDGET(ui->label_album_title), GTK_ALIGN_START);
gtk_widget_set_halign(GTK_WIDGET(ui->label_album_summary), GTK_ALIGN_START);
gtk_widget_set_halign(GTK_WIDGET(ui->label_album_privacy), GTK_ALIGN_START);
// create entries
GtkListStore *model_username = gtk_list_store_new(COMBO_USER_MODEL_NB_COL, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING); // text, token, id
ui->comboBox_username = GTK_COMBO_BOX(gtk_combo_box_new_with_model(GTK_TREE_MODEL(model_username)));
GtkCellRenderer *p_cell = gtk_cell_renderer_text_new();
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(ui->comboBox_username), p_cell, FALSE);
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(ui->comboBox_username), p_cell, "text", 0, NULL);
ui->entry_album_title = GTK_ENTRY(gtk_entry_new());
ui->entry_album_summary = GTK_ENTRY(gtk_entry_new());
dt_gui_key_accel_block_on_focus_connect(GTK_WIDGET(ui->comboBox_username));
dt_gui_key_accel_block_on_focus_connect(GTK_WIDGET(ui->entry_album_title));
dt_gui_key_accel_block_on_focus_connect(GTK_WIDGET(ui->entry_album_summary));
gtk_entry_set_width_chars(GTK_ENTRY(ui->entry_album_title), 0);
gtk_entry_set_width_chars(GTK_ENTRY(ui->entry_album_summary), 0);
// retrieve saved accounts
ui_refresh_users(ui);
//////// album list /////////
GtkWidget *albumlist = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
GtkListStore *model_album
= gtk_list_store_new(COMBO_ALBUM_MODEL_NB_COL, G_TYPE_STRING, G_TYPE_STRING); // name, id
ui->comboBox_album = GTK_COMBO_BOX(gtk_combo_box_new_with_model(GTK_TREE_MODEL(model_album)));
p_cell = gtk_cell_renderer_text_new();
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(ui->comboBox_album), p_cell, FALSE);
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(ui->comboBox_album), p_cell, "text", 0, NULL);
gtk_widget_set_sensitive(GTK_WIDGET(ui->comboBox_album), FALSE);
gtk_combo_box_set_row_separator_func(ui->comboBox_album, combobox_separator, ui->comboBox_album, NULL);
gtk_box_pack_start(GTK_BOX(albumlist), GTK_WIDGET(ui->comboBox_album), TRUE, TRUE, 0);
ui->comboBox_privacy = GTK_COMBO_BOX(gtk_combo_box_text_new());
GtkListStore *list_store = gtk_list_store_new(COMBO_ALBUM_MODEL_NB_COL, G_TYPE_STRING, G_TYPE_INT);
GtkTreeIter iter;
gtk_list_store_append(list_store, &iter);
gtk_list_store_set(list_store, &iter, COMBO_PRIVACY_MODEL_NAME_COL, _("only me"),
COMBO_PRIVACY_MODEL_VAL_COL, FBALBUM_PRIVACY_SELF, -1);
gtk_list_store_append(list_store, &iter);
gtk_list_store_set(list_store, &iter, COMBO_PRIVACY_MODEL_NAME_COL, _("friends"),
COMBO_PRIVACY_MODEL_VAL_COL, FBALBUM_PRIVACY_ALL_FRIENDS, -1);
gtk_list_store_append(list_store, &iter);
gtk_list_store_set(list_store, &iter, COMBO_PRIVACY_MODEL_NAME_COL, _("public"),
COMBO_PRIVACY_MODEL_VAL_COL, FBALBUM_PRIVACY_EVERYONE, -1);
gtk_list_store_append(list_store, &iter);
gtk_list_store_set(list_store, &iter, COMBO_PRIVACY_MODEL_NAME_COL, _("friends of friends"),
COMBO_PRIVACY_MODEL_VAL_COL, FBALBUM_PRIVACY_FRIENDS_OF_FRIENDS, -1);
gtk_combo_box_set_model(ui->comboBox_privacy, GTK_TREE_MODEL(list_store));
gtk_combo_box_set_active(GTK_COMBO_BOX(ui->comboBox_privacy), 1); // Set default permission to private
ui->button_login = GTK_BUTTON(gtk_button_new_with_label(_("login")));
ui->connected = FALSE;
// pack the ui
////the auth box
GtkWidget *hbox_auth = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5);
GtkWidget *vbox_auth_labels = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
GtkWidget *vbox_auth_fields = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_box_pack_start(GTK_BOX(hbox_auth), vbox_auth_labels, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox_auth), vbox_auth_fields, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(hbox_auth), TRUE, FALSE, 2);
gtk_box_pack_start(GTK_BOX(vbox_auth_fields), GTK_WIDGET(ui->comboBox_username), TRUE, FALSE, 2);
gtk_box_pack_start(GTK_BOX(vbox_auth_labels), GTK_WIDGET(gtk_label_new("")), TRUE, TRUE, 2);
gtk_box_pack_start(GTK_BOX(vbox_auth_fields), GTK_WIDGET(ui->button_login), TRUE, FALSE, 2);
gtk_box_pack_start(GTK_BOX(vbox_auth_fields), GTK_WIDGET(albumlist), TRUE, FALSE, 2);
////the album creation box
ui->hbox_album = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5));
gtk_widget_set_no_show_all(GTK_WIDGET(ui->hbox_album), TRUE); // hide it by default
GtkWidget *vbox_album_labels = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
GtkWidget *vbox_album_fields = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(ui->hbox_album), TRUE, FALSE, 5);
gtk_box_pack_start(GTK_BOX(ui->hbox_album), vbox_album_labels, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(ui->hbox_album), vbox_album_fields, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(vbox_album_labels), GTK_WIDGET(ui->label_album_title), TRUE, TRUE, 0);
//.........这里部分代码省略.........
开发者ID:SenorNaddy,项目名称:darktable,代码行数:101,代码来源:facebook.c
示例9: _fcitx_main_window_add_addon_page
void _fcitx_main_window_add_addon_page(FcitxMainWindow* self)
{
/* load addon */
FcitxAddon* addon;
utarray_new(self->addons, &addonicd);
FcitxAddonsLoad(self->addons);
GtkWidget* vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
/* advance check box */
self->advancecheckbox = gtk_check_button_new_with_label(_("Advance"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(self->advancecheckbox), FALSE);
g_signal_connect(G_OBJECT(self->advancecheckbox), "toggled", G_CALLBACK(_fcitx_main_window_checkbox_changed), self);
/* filter entry */
self->filterentry = gtk_entry_new();
gtk_entry_set_icon_from_gicon (GTK_ENTRY (self->filterentry),
GTK_ENTRY_ICON_SECONDARY,
g_themed_icon_new_with_default_fallbacks("edit-clear"));
g_object_set(G_OBJECT(self->filterentry), "margin", 5, NULL);
#if GTK_CHECK_VERSION(3,2,0)
gtk_entry_set_placeholder_text(GTK_ENTRY (self->filterentry), _("Search Addon"));
#endif
g_signal_connect(G_OBJECT(self->filterentry), "icon-press", G_CALLBACK (icon_press_cb), NULL);
/* list view */
self->addonstore = gtk_list_store_new(N_COLUMNS, G_TYPE_POINTER);
for (addon = (FcitxAddon *) utarray_front(self->addons);
addon != NULL;
addon = (FcitxAddon *) utarray_next(self->addons, addon)) {
GtkTreeIter iter;
gtk_list_store_append(self->addonstore, &iter);
gtk_list_store_set(self->addonstore, &iter, LIST_ADDON, addon, -1);
}
self->filtermodel = gtk_tree_model_filter_new(GTK_TREE_MODEL(self->addonstore), NULL);
gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(self->filtermodel),
(GtkTreeModelFilterVisibleFunc) _filter_addon_func,
self,
NULL);
self->addonview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(self->filtermodel));
/* add column check box */
self->togglecell = gtk_cell_renderer_toggle_new();
self->checkboxcolumn = gtk_tree_view_column_new_with_attributes("Enable", self->togglecell, NULL);
gtk_tree_view_column_set_visible(self->checkboxcolumn, FALSE);
gtk_tree_view_append_column(GTK_TREE_VIEW(self->addonview), self->checkboxcolumn);
gtk_cell_layout_set_cell_data_func(GTK_CELL_LAYOUT(self->checkboxcolumn),
self->togglecell,
_fcitx_main_window_enabled_data_func,
NULL,
NULL);
/* add column text */
GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes("Name", renderer, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(self->addonview), column);
gtk_cell_layout_set_cell_data_func(GTK_CELL_LAYOUT(column),
renderer,
_fcitx_main_window_name_data_func,
NULL,
NULL);
/* add addon list to vbox */
GtkWidget* swin = gtk_scrolled_window_new(NULL, NULL);
g_object_set(swin, "hscrollbar-policy", GTK_POLICY_NEVER, NULL);
g_object_set(self->addonview, "headers-visible", FALSE, NULL);
gtk_container_add(GTK_CONTAINER(swin), self->addonview);
gtk_box_pack_start(GTK_BOX(vbox), swin, TRUE, TRUE, 0);
g_object_set(G_OBJECT(swin), "margin-left", 5, "margin-right", 5, "shadow-type", GTK_SHADOW_IN, NULL);
g_signal_connect(G_OBJECT(self->togglecell), "toggled",
G_CALLBACK(_fcitx_main_window_toggled_cb), GTK_TREE_MODEL(self->addonstore));
gtk_box_pack_start(GTK_BOX(vbox), self->advancecheckbox, FALSE, TRUE, 0);
g_object_set(G_OBJECT(self->advancecheckbox), "margin-left", 5, "margin-right", 5, NULL);
gtk_box_pack_start(GTK_BOX(vbox), self->filterentry, FALSE, TRUE, 5);
/* configure button */
GtkWidget* hbuttonbox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
gtk_box_pack_start(GTK_BOX(vbox), hbuttonbox, FALSE, TRUE, 0);
g_object_set(G_OBJECT(hbuttonbox), "margin", 5, NULL);
self->button = gtk_button_new_with_label(_("Configure"));
gtk_widget_set_sensitive(self->button, FALSE);
gtk_button_set_image(GTK_BUTTON(self->button), gtk_image_new_from_gicon(g_themed_icon_new_with_default_fallbacks("preferences-system"), GTK_ICON_SIZE_BUTTON));
gtk_box_pack_start(GTK_BOX(hbuttonbox), self->button, TRUE, TRUE, 0);
g_signal_connect(G_OBJECT(self->button), "clicked", G_CALLBACK(_fcitx_main_window_configure_button_clicked), self);
GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(self->addonview));
gtk_tree_selection_set_mode(selection, GTK_SELECTION_BROWSE);
g_signal_connect(G_OBJECT(selection), "changed",
G_CALLBACK(_fcitx_main_window_addon_selection_changed), self);
g_signal_connect(G_OBJECT(self->filterentry), "changed", G_CALLBACK(_fcitx_main_window_filtertext_changed), self);
gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(self->filtermodel));
g_signal_connect(G_OBJECT(self->addonview),
"row-activated",
G_CALLBACK(_fcitx_main_window_addon_row_activated), self);
//.........这里部分代码省略.........
开发者ID:simbapeer,项目名称:fcitx-configtool,代码行数:101,代码来源:main_window.c
示例10: prepare_controls_for_state
void
prepare_controls_for_state (MafwPlayState state)
{
gboolean play_possible;
gboolean pause_possible;
gboolean stop_possible;
switch (state) {
case Stopped:
/* Disable the seekbar when the state is stopped */
gtk_widget_set_sensitive(position_hscale, FALSE);
play_possible = TRUE;
pause_possible = FALSE;
stop_possible = TRUE;
in_state_stopped = TRUE;
remove_timeout ();
g_signal_handlers_block_by_func (G_OBJECT(position_hscale),
on_position_hscale_value_changed, NULL);
gtk_range_set_value (GTK_RANGE (position_hscale), 0.0);
gtk_label_set_text(GTK_LABEL(position_label), "00:00");
g_signal_handlers_unblock_by_func(G_OBJECT(position_hscale),
on_position_hscale_value_changed, NULL);
break;
case Paused:
play_possible = TRUE;
pause_possible = FALSE;
stop_possible = TRUE;
in_state_stopped = FALSE;
remove_timeout ();
update_position (NULL);
break;
case Playing:
play_possible = FALSE;
pause_possible = TRUE;
stop_possible = TRUE;
in_state_stopped = FALSE;
/* Start tracking media position in playing state */
add_timeout ();
break;
case Transitioning:
play_possible = FALSE;
pause_possible = FALSE;
stop_possible = TRUE;
in_state_stopped = FALSE;
remove_timeout ();
break;
default:
play_possible = TRUE;
pause_possible = FALSE;
stop_possible = TRUE;
in_state_stopped = FALSE;
remove_timeout ();
break;
}
if (!stop_possible) {
g_signal_handlers_block_by_func
(position_hscale,
on_position_hscale_value_changed,
NULL);
gtk_range_set_value (GTK_RANGE (position_hscale), 0.0);
gtk_label_set_text(GTK_LABEL(position_label), "00:00");
g_signal_handlers_unblock_by_func
(position_hscale,
on_position_hscale_value_changed,
NULL);
}
if (play_possible == TRUE) {
GtkWidget *image;
image = gtk_image_new_from_icon_name("camera_playback",
HILDON_ICON_SIZE_SMALL);
gtk_button_set_image(GTK_BUTTON(play_button), image);
}
if (pause_possible == TRUE) {
GtkWidget *image;
image = gtk_image_new_from_icon_name("camera_video_pause",
HILDON_ICON_SIZE_SMALL);
gtk_button_set_image(GTK_BUTTON(play_button), image);
}
if (play_possible == FALSE && pause_possible == FALSE) {
gtk_widget_set_sensitive (play_button, FALSE);
//.........这里部分代码省略.........
开发者ID:community-ssu,项目名称:mafw,代码行数:101,代码来源:renderer-controls.c
示例11: setup_renderer_controls
void
setup_renderer_controls (GtkBuilder *builder)
{
GtkWidget* image;
volume_vscale = GTK_WIDGET(gtk_builder_get_object(builder,
"volume-vscale"));
g_assert (volume_vscale != NULL);
position_hscale = GTK_WIDGET(gtk_builder_get_object(builder,
"position-hscale"));
g_assert (position_hscale != NULL);
position_label = GTK_WIDGET(gtk_builder_get_object(builder,
"position-label"));
g_assert (position_label != NULL);
/* Previous */
prev_button = GTK_WIDGET(gtk_builder_get_object(builder,
"previous-button"));
g_assert (prev_button != NULL);
/* Seek backwards */
seek_backwards_button =
GTK_WIDGET(gtk_builder_get_object(builder,
"seek-backwards-button"));
g_assert (seek_backwards_button != NULL);
/* Play */
play_button = GTK_WIDGET(gtk_builder_get_object(builder,
"play-button"));
g_assert (play_button != NULL);
gtk_button_set_label(GTK_BUTTON(play_button), NULL);
image = gtk_image_new_from_icon_name("camera_playback",
HILDON_ICON_SIZE_SMALL);
gtk_button_set_image(GTK_BUTTON(play_button), image);
/* Stop */
stop_button = GTK_WIDGET(gtk_builder_get_object(builder,
"stop-button"));
g_assert (stop_button != NULL);
/* Seek forwards */
seek_forwards_button =
GTK_WIDGET(gtk_builder_get_object(builder,
"seek-forwards-button"));
g_assert (seek_forwards_button != NULL);
/* Next */
next_button = GTK_WIDGET(gtk_builder_get_object(builder,
"next-button"));
g_assert (next_button != NULL);
/* Mute */
mute_toggle = GTK_WIDGET(gtk_builder_get_object(builder,
"mute-button"));
g_assert (mute_toggle != NULL);
#ifndef MAFW_TEST_GUI_ENABLE_MUTE
gtk_widget_set_sensitive(mute_toggle, FALSE);
#endif
timeout_id = 0;
/* Seeking is disabled by default */
enable_seek_buttons(FALSE);
g_object_weak_ref (G_OBJECT (position_hscale),
(GWeakNotify) remove_timeout,
NULL);
}
开发者ID:community-ssu,项目名称:mafw,代码行数:72,代码来源:renderer-controls.c
示例12: WXUNUSED
GdkWindow *wxCheckBox::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const
{
return GTK_BUTTON(m_widgetCheckbox)->event_window;
}
开发者ID:Bluehorn,项目名称:wxPython,代码行数:4,代码来源:checkbox.cpp
示例13: nimf_settings_page_key_build_string_array
static GtkWidget *
nimf_settings_page_key_build_string_array (NimfSettingsPageKey *page_key)
{
GtkListStore *store;
GtkWidget *treeview;
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
GtkWidget *scrolled_w;
GtkWidget *hbox;
GtkWidget *vbox;
GtkWidget *button1;
GtkWidget *button2;
gchar **strv;
gchar *detailed_signal;
GtkTreeIter iter;
gint j;
button1 = gtk_button_new_from_icon_name ("list-add", GTK_ICON_SIZE_SMALL_TOOLBAR);
button2 = gtk_button_new_from_icon_name ("list-remove", GTK_ICON_SIZE_SMALL_TOOLBAR);
gtk_button_set_relief (GTK_BUTTON (button1), GTK_RELIEF_NONE);
gtk_button_set_relief (GTK_BUTTON (button2), GTK_RELIEF_NONE);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
#if GTK_CHECK_VERSION (3, 12, 0)
gtk_widget_set_margin_end (page_key->label, 15);
#else
gtk_widget_set_margin_right (page_key->label, 15);
#endif
gtk_box_pack_start (GTK_BOX (hbox), page_key->label, FALSE, FALSE, 0);
gtk_box_pack_end (GTK_BOX (hbox), button2, FALSE, FALSE, 0);
gtk_box_pack_end (GTK_BOX (hbox), button1, FALSE, FALSE, 0);
store = gtk_list_store_new (1, G_TYPE_STRING);
strv = g_settings_get_strv (page_key->gsettings, page_key->key);
for (j = 0; strv[j] != NULL; j++)
{
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, strv[j], -1);
}
treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
g_object_unref (store);
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes ("Hotkeys", renderer,
"text", 0, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), FALSE);
scrolled_w = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_w),
GTK_SHADOW_ETCHED_IN);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_w),
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
gtk_container_add (GTK_CONTAINER (scrolled_w), treeview);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_box_pack_end (GTK_BOX (vbox), scrolled_w, FALSE, FALSE, 0);
page_key->treeview = treeview;
detailed_signal = g_strdup_printf ("changed::%s", page_key->key);
g_signal_connect (treeview, "realize",
G_CALLBACK (on_tree_view_realize), scrolled_w);
g_signal_connect (button1, "clicked", G_CALLBACK (on_button_clicked_add), page_key);
g_signal_connect (button2, "clicked", G_CALLBACK (on_button_clicked_remove), page_key);
g_signal_connect (page_key->gsettings, detailed_signal,
G_CALLBACK (on_gsettings_changed), page_key->treeview);
g_strfreev (strv);
g_free (detailed_signal);
return vbox;
}
开发者ID:wcho,项目名称:nimf,代码行数:76,代码来源:nimf-settings.c
示例14: thunar_chooser_button_pressed
//.........这里部分代码省略.........
ThunarVfsMimeInfo *info;
ThunarIconFactory *icon_factory;
GtkIconTheme *icon_theme;
const gchar *icon_name;
GdkPixbuf *icon;
GtkWidget *image;
GtkWidget *item;
GtkWidget *menu;
GList *applications;
GList *lp;
gint icon_size;
_thunar_return_if_fail (THUNAR_IS_CHOOSER_BUTTON (chooser_button));
_thunar_return_if_fail (chooser_button->button == button);
_thunar_return_if_fail (GTK_IS_BUTTON (button));
/* verify that we have a valid file */
if (G_UNLIKELY (chooser_button->file == NULL))
return;
/* determine the mime info for the file */
info = thunar_file_get_mime_info (chooser_button->file);
/* determine the default application */
default_application = thunar_vfs_mime_database_get_default_application (chooser_button->database, info);
if (G_UNLIKELY (default_application == NULL))
{
/* no default application, just popup the application chooser */
thunar_chooser_button_activate_other (chooser_button);
return;
}
/* determine all applications that claim to be able to handle the file */
applications = thunar_vfs_mime_database_get_applications (chooser_button->database, info);
/* make sure the default application comes first */
lp = g_list_find (applications, default_application);
if (G_LIKELY (lp != NULL))
{
applications = g_list_delete_link (applications, lp);
g_object_unref (G_OBJECT (default_application));
}
applications = g_list_prepend (applications, default_application);
/* allocate a new popup menu */
menu = gtk_menu_new ();
/* determine the icon size for menus */
gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &icon_size, &icon_size);
/* determine the icon factory for our screen */
icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (button));
icon_factory = thunar_icon_factory_get_for_icon_theme (icon_theme);
/* add the other possible applications */
for (lp = applications; lp != NULL; lp = lp->next)
{
item = gtk_image_menu_item_new_with_label (thunar_vfs_mime_handler_get_name (lp->data));
g_object_set_data_full (G_OBJECT (item), I_("thunar-vfs-mime-application"), lp->data, g_object_unref);
g_signal_connect_swapped (G_OBJECT (item), "activate", G_CALLBACK (thunar_chooser_button_activate), chooser_button);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
gtk_widget_show (item);
/* setup the icon for the application */
icon_name = thunar_vfs_mime_handler_lookup_icon_name (lp->data, icon_theme);
icon = thunar_icon_factory_load_icon (icon_factory, icon_name, icon_size, NULL, FALSE);
image = gtk_i
|
请发表评论