本文整理汇总了C++中GTK_TREE_MODEL函数 的典型用法代码示例。如果您正苦于以下问题:C++ GTK_TREE_MODEL函数的具体用法?C++ GTK_TREE_MODEL怎么用?C++ GTK_TREE_MODEL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_TREE_MODEL函数 的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: lang_set_custom_callback
/*
* This function sets the custom list when the language list has changed in
* the language dialog (launched from language button or F10 menu).
*/
void
lang_set_custom_callback (gchar *language)
{
GtkListStore *lang_model = mdm_lang_get_model ();
GtkTreeIter iter;
gboolean valid;
char *locale_name;
int i=0;
/* Do nothing if there is no language widget */
if (language_widget == NULL)
return;
/*
* Handle for either combo box or list style, depending on which is being
* used.
. */
if (GTK_IS_COMBO_BOX (language_widget))
{
valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (lang_model),
&iter);
while (valid)
{
gtk_tree_model_get (GTK_TREE_MODEL (lang_model), &iter,
LOCALE_COLUMN, &locale_name, -1);
if (strcmp (language, locale_name) == 0)
{
gtk_combo_box_set_active (GTK_COMBO_BOX (language_widget), i);
break;
}
valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (lang_model), &iter);
i++;
}
}
else if (GTK_IS_SCROLLED_WINDOW (language_widget) &&
GTK_IS_TREE_VIEW (GTK_BIN (language_widget)->child))
{
GtkTreeView *tv = GTK_TREE_VIEW (GTK_BIN (language_widget)->child);
GtkTreeModel *tm = gtk_tree_view_get_model (tv);
GtkTreeSelection *selection = gtk_tree_view_get_selection (tv);
GtkTreeIter loopiter;
if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (tm), &loopiter))
{
do
{
char *locale_file;
gtk_tree_model_get (GTK_TREE_MODEL (tm), &loopiter, GREETER_LIST_ID, &locale_file, -1);
if (locale_file != NULL && strcmp (language, locale_file) == 0)
{
GtkTreePath *path = gtk_tree_model_get_path (tm, &loopiter);
gtk_tree_selection_select_iter (selection, &loopiter);
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (tv),
path, NULL,
FALSE, 0.0, 0.0);
gtk_tree_path_free (path);
break;
}
} while (gtk_tree_model_iter_next (GTK_TREE_MODEL (tm), &loopiter));
}
}
}
开发者ID:3dfxmadscientist, 项目名称:mdm, 代码行数:69, 代码来源:greeter_item_customlist.c
示例2: fe_dcc_open_recv_win
int
fe_dcc_open_recv_win (int passive)
{
GtkWidget *radio, *table, *vbox, *bbox, *view, *exp, *detailbox;
GtkListStore *store;
GSList *group;
if (dccfwin.window)
{
if (!passive)
mg_bring_tofront (dccfwin.window);
return TRUE;
}
dccfwin.window = mg_create_generic_tab ("Transfers", _(DISPLAY_NAME": Uploads and Downloads"),
FALSE, TRUE, close_dcc_file_window, NULL,
win_width, win_height, &vbox, 0);
gtk_container_set_border_width (GTK_CONTAINER (dccfwin.window), 3);
gtk_box_set_spacing (GTK_BOX (vbox), 3);
store = gtk_list_store_new (N_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_POINTER, GDK_TYPE_COLOR);
view = gtkutil_treeview_new (vbox, GTK_TREE_MODEL (store), NULL, -1);
gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (view), TRUE);
/* Up/Down Icon column */
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (view), -1, NULL,
gtk_cell_renderer_pixbuf_new (),
"pixbuf", COL_TYPE, NULL);
dcc_add_column (view, COL_STATUS, COL_COLOR, _("Status"), FALSE);
dcc_add_column (view, COL_FILE, COL_COLOR, _("File"), FALSE);
dcc_add_column (view, COL_SIZE, COL_COLOR, _("Size"), TRUE);
dcc_add_column (view, COL_POS, COL_COLOR, _("Position"), TRUE);
dcc_add_column (view, COL_PERC, COL_COLOR, "%", TRUE);
dcc_add_column (view, COL_SPEED, COL_COLOR, "KB/s", TRUE);
dcc_add_column (view, COL_ETA, COL_COLOR, _("ETA"), FALSE);
dcc_add_column (view, COL_NICK, COL_COLOR, _("Nick"), FALSE);
gtk_tree_view_column_set_expand (gtk_tree_view_get_column (GTK_TREE_VIEW (view), COL_FILE), TRUE);
gtk_tree_view_column_set_expand (gtk_tree_view_get_column (GTK_TREE_VIEW (view), COL_NICK), TRUE);
dccfwin.list = view;
dccfwin.store = store;
dccfwin.sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
view_mode = VIEW_BOTH;
gtk_tree_selection_set_mode (dccfwin.sel, GTK_SELECTION_MULTIPLE);
if (!prefs.hex_gui_tab_utils)
g_signal_connect (G_OBJECT (dccfwin.window), "configure_event",
G_CALLBACK (dcc_configure_cb), 0);
g_signal_connect (G_OBJECT (dccfwin.sel), "changed",
G_CALLBACK (dcc_row_cb), NULL);
/* double click */
g_signal_connect (G_OBJECT (view), "row-activated",
G_CALLBACK (dcc_dclick_cb), NULL);
table = gtk_table_new (1, 3, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 16);
gtk_box_pack_start (GTK_BOX (vbox), table, 0, 0, 0);
radio = gtk_radio_button_new_with_mnemonic (NULL, _("Both"));
g_signal_connect (G_OBJECT (radio), "toggled",
G_CALLBACK (dcc_toggle), GINT_TO_POINTER (VIEW_BOTH));
gtk_table_attach (GTK_TABLE (table), radio, 3, 4, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio));
radio = gtk_radio_button_new_with_mnemonic (group, _("Uploads"));
g_signal_connect (G_OBJECT (radio), "toggled",
G_CALLBACK (dcc_toggle), GINT_TO_POINTER (VIEW_UPLOAD));
gtk_table_attach (GTK_TABLE (table), radio, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio));
radio = gtk_radio_button_new_with_mnemonic (group, _("Downloads"));
g_signal_connect (G_OBJECT (radio), "toggled",
G_CALLBACK (dcc_toggle), GINT_TO_POINTER (VIEW_DOWNLOAD));
gtk_table_attach (GTK_TABLE (table), radio, 2, 3, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
exp = gtk_expander_new (_("Details"));
gtk_table_attach (GTK_TABLE (table), exp, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
detailbox = gtk_table_new (3, 3, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (detailbox), 6);
gtk_table_set_row_spacings (GTK_TABLE (detailbox), 2);
gtk_container_set_border_width (GTK_CONTAINER (detailbox), 6);
g_signal_connect (G_OBJECT (exp), "activate",
G_CALLBACK (dcc_exp_cb), detailbox);
gtk_table_attach (GTK_TABLE (table), detailbox, 0, 4, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
dccfwin.file_label = dcc_detail_label (_("File:"), detailbox, 0);
dccfwin.address_label = dcc_detail_label (_("Address:"), detailbox, 1);
bbox = gtk_hbutton_box_new ();
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD);
gtk_box_pack_end (GTK_BOX (vbox), bbox, FALSE, FALSE, 2);
dccfwin.abort_button = gtkutil_button (bbox, GTK_STOCK_CANCEL, 0, abort_clicked, 0, _("Abort"));
dccfwin.accept_button = gtkutil_button (bbox, GTK_STOCK_APPLY, 0, accept_clicked, 0, _("Accept"));
dccfwin.resume_button = gtkutil_button (bbox, GTK_STOCK_REFRESH, 0, resume_clicked, 0, _("Resume"));
dccfwin.open_button = gtkutil_button (bbox, 0, 0, browse_dcc_folder, 0, _("Open Folder..."));
gtk_widget_set_sensitive (dccfwin.accept_button, FALSE);
//.........这里部分代码省略.........
开发者ID:fuzzmz, 项目名称:hexchat, 代码行数:101, 代码来源:dccgui.c
示例3: create_categories_section
static void
create_categories_section (GtkWidget *categories_vbox, GUI *appGUI)
{
GtkTreeViewColumn *column;
GtkCellRenderer *renderer;
GtkWidget *table, *scrolledwindow, *treeview;
table = gtk_table_new (4, 3, FALSE);
gtk_box_pack_start (GTK_BOX (categories_vbox), table, TRUE, TRUE, 0);
gtk_container_set_border_width (GTK_CONTAINER (table), 8);
gtk_table_set_row_spacings (GTK_TABLE (table), 8);
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
appGUI->opt->tasks_category_entry = gtk_entry_new ();
gtk_table_attach (GTK_TABLE (table), appGUI->opt->tasks_category_entry, 0, 1, 3, 4,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0);
g_signal_connect (G_OBJECT (appGUI->opt->tasks_category_entry), "key_release_event",
G_CALLBACK (tasks_category_entry_key_release_cb), appGUI);
scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
gtk_table_attach (GTK_TABLE (table), scrolledwindow, 0, 3, 0, 3,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow), GTK_SHADOW_IN);
treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (appGUI->opt->tasks_category_store));
gtk_container_add (GTK_CONTAINER (scrolledwindow), treeview);
gtk_container_set_border_width (GTK_CONTAINER (treeview), 4);
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), TRUE);
gtk_tree_view_set_reorderable (GTK_TREE_VIEW (treeview), TRUE);
gtk_tree_view_set_enable_search (GTK_TREE_VIEW (treeview), FALSE);
gtk_widget_set_size_request (treeview, -1, 120);
appGUI->opt->tasks_category_treeview = treeview;
appGUI->opt->tasks_category_select = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
g_signal_connect (G_OBJECT (appGUI->opt->tasks_category_select), "changed", G_CALLBACK (tasks_category_selected_cb), appGUI);
renderer = gtk_cell_renderer_text_new ();
g_object_set (renderer, "editable", TRUE, "editable-set", TRUE, NULL);
g_signal_connect (G_OBJECT (renderer), "edited", G_CALLBACK (tasks_category_cell_edited_cb), appGUI);
column = gtk_tree_view_column_new_with_attributes (_("Name"), renderer, "text", TC_COLUMN_NAME, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
gtk_tree_view_column_set_expand (column, TRUE);
renderer = gtk_cell_renderer_toggle_new (); /* Show in calendar */
column = gtk_tree_view_column_new_with_attributes(_("Calendar"), renderer, "active", TC_COLUMN_CALENDAR, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
g_signal_connect (renderer, "toggled", G_CALLBACK (tsk_show_in_calendar_toggled), appGUI);
renderer = gtk_cell_renderer_toggle_new (); /* Show in tasks list */
column = gtk_tree_view_column_new_with_attributes (_("Tasks"), renderer, "active", TC_COLUMN_TASKS, NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
g_signal_connect (renderer, "toggled", G_CALLBACK (tsk_show_in_tasks_list_toggled), appGUI);
if (config.default_stock_icons)
appGUI->opt->tasks_category_add_button = utl_gui_stock_button (GTK_STOCK_ADD, FALSE);
else
appGUI->opt->tasks_category_add_button = utl_gui_stock_button (OSMO_STOCK_BUTTON_ADD, FALSE);
gtk_widget_set_sensitive (appGUI->opt->tasks_category_add_button, FALSE);
gtk_table_attach (GTK_TABLE (table), appGUI->opt->tasks_category_add_button, 1, 2, 3, 4,
(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
g_signal_connect (appGUI->opt->tasks_category_add_button, "clicked", G_CALLBACK (tasks_category_add_cb), appGUI);
if (config.default_stock_icons)
appGUI->opt->tasks_category_remove_button = utl_gui_stock_button (GTK_STOCK_REMOVE, FALSE);
else
appGUI->opt->tasks_category_remove_button = utl_gui_stock_button (OSMO_STOCK_BUTTON_REMOVE, FALSE);
gtk_widget_set_sensitive (appGUI->opt->tasks_category_remove_button, FALSE);
gtk_table_attach (GTK_TABLE (table), appGUI->opt->tasks_category_remove_button, 2, 3, 3, 4,
(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0);
g_signal_connect (appGUI->opt->tasks_category_remove_button, "clicked", G_CALLBACK (tasks_category_remove_cb), appGUI);
}
开发者ID:rosedu, 项目名称:osmo, 代码行数:73, 代码来源:tasks_preferences_gui.c
示例4: update_source
static void
update_source (RBDiscRecorderPlugin *pi,
RBShell *shell)
{
GtkAction *burn_action, *copy_action;
gboolean playlist_active, is_audiocd_active;
RBSource *selected_source;
const char *source_type;
if (pi->selected_source != NULL) {
RhythmDBQueryModel *model;
g_object_get (pi->selected_source, "query-model", &model, NULL);
g_signal_handlers_disconnect_by_func (model, playlist_row_inserted_cb, pi);
g_signal_handlers_disconnect_by_func (model, playlist_entries_changed, pi);
g_object_unref (model);
}
g_object_get (shell, "selected-source", &selected_source, NULL);
/* for now restrict to playlist sources */
playlist_active = RB_IS_PLAYLIST_SOURCE (selected_source);
source_type = G_OBJECT_TYPE_NAME (selected_source);
is_audiocd_active = g_str_equal (source_type, "RBAudioCdSource");
burn_action = gtk_action_group_get_action (pi->action_group,
"MusicPlaylistBurnToDiscPlaylist");
copy_action = gtk_action_group_get_action (pi->action_group,
"MusicAudioCDDuplicate");
if (pi->enabled && playlist_active && rb_disc_recorder_has_burner (pi)) {
RhythmDBQueryModel *model;
g_object_get (selected_source, "query-model", &model, NULL);
/* monitor for changes, to enable/disable the burn menu item */
g_signal_connect_object (G_OBJECT (model),
"row_inserted",
G_CALLBACK (playlist_row_inserted_cb),
pi, 0);
g_signal_connect_object (G_OBJECT (model),
"post-entry-delete",
G_CALLBACK (playlist_entries_changed),
pi, 0);
playlist_entries_changed (GTK_TREE_MODEL (model), NULL, pi);
g_object_unref (model);
gtk_action_set_visible (burn_action, TRUE);
} else {
gtk_action_set_visible (burn_action, FALSE);
}
if (pi->enabled && is_audiocd_active && is_copy_available (pi)) {
gtk_action_set_visible (copy_action, TRUE);
} else {
gtk_action_set_visible (copy_action, FALSE);
}
if (pi->selected_source != NULL) {
g_object_unref (pi->selected_source);
}
pi->selected_source = selected_source;
}
开发者ID:ivankelly, 项目名称:Rhythmbox-Spotify-Plugin, 代码行数:63, 代码来源:rb-disc-recorder-plugin.c
示例5: gtk_table_new
void ColorICCSelector::init()
{
GtkWidget *t;
gint row = 0;
_updating = FALSE;
_dragging = FALSE;
t = gtk_table_new (5, 3, FALSE);
gtk_widget_show (t);
gtk_box_pack_start (GTK_BOX (_csel), t, TRUE, TRUE, 4);
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
//guint partCount = _cmsChannelsOf( icSigRgbData );
gchar const** names = 0;
gchar const** tips = 0;
getThings( cmsSigRgbData, names, tips, _fooScales );
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
/* Create components */
row = 0;
_fixupBtn = gtk_button_new_with_label(_("Fix"));
g_signal_connect( G_OBJECT(_fixupBtn), "clicked", G_CALLBACK(_fixupHit), (gpointer)this );
gtk_widget_set_sensitive( _fixupBtn, FALSE );
gtk_widget_set_tooltip_text( _fixupBtn, _("Fix RGB fallback to match icc-color() value.") );
//gtk_misc_set_alignment( GTK_MISC (_fixupBtn), 1.0, 0.5 );
gtk_widget_show( _fixupBtn );
gtk_table_attach( GTK_TABLE (t), _fixupBtn, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, XPAD, YPAD );
// Combobox and store with 2 columns : label (0) and full name (1)
GtkListStore *store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
_profileSel = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store));
GtkCellRenderer *renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (_profileSel), renderer, TRUE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (_profileSel), renderer, "text", 0, NULL);
GtkTreeIter iter;
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, _("<none>"), 1, _("<none>"), -1);
gtk_widget_show( _profileSel );
gtk_combo_box_set_active( GTK_COMBO_BOX(_profileSel), 0 );
gtk_table_attach( GTK_TABLE(t), _profileSel, 1, 2, row, row + 1, GTK_FILL, GTK_FILL, XPAD, YPAD );
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
_profChangedID = g_signal_connect( G_OBJECT(_profileSel), "changed", G_CALLBACK(_profileSelected), (gpointer)this );
#else
gtk_widget_set_sensitive( _profileSel, false );
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
row++;
_fooCount = 4;
_fooAdj = new GtkAdjustment*[_fooCount];
_fooSlider = new GtkWidget*[_fooCount];
_fooBtn = new GtkWidget*[_fooCount];
_fooLabel = new GtkWidget*[_fooCount];
_fooMap = new guchar*[_fooCount];
for ( guint i = 0; i < _fooCount; i++ ) {
/* Label */
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
_fooLabel[i] = gtk_label_new_with_mnemonic( names[i] );
#else
_fooLabel[i] = gtk_label_new_with_mnemonic( "." );
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
gtk_misc_set_alignment( GTK_MISC (_fooLabel[i]), 1.0, 0.5 );
gtk_widget_show( _fooLabel[i] );
gtk_table_attach( GTK_TABLE (t), _fooLabel[i], 0, 1, row, row + 1, GTK_FILL, GTK_FILL, XPAD, YPAD );
/* Adjustment */
gdouble step = static_cast<gdouble>(_fooScales[i]) / 100.0;
gdouble page = static_cast<gdouble>(_fooScales[i]) / 10.0;
gint digits = (step > 0.9) ? 0 : 2;
_fooAdj[i] = GTK_ADJUSTMENT( gtk_adjustment_new( 0.0, 0.0, _fooScales[i], step, page, page ) );
/* Slider */
_fooSlider[i] = sp_color_slider_new( _fooAdj[i] );
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
gtk_widget_set_tooltip_text( _fooSlider[i], tips[i] );
#else
gtk_widget_set_tooltip_text( _fooSlider[i], "." );
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
gtk_widget_show( _fooSlider[i] );
gtk_table_attach( GTK_TABLE (t), _fooSlider[i], 1, 2, row, row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)GTK_FILL, XPAD, YPAD );
_fooBtn[i] = gtk_spin_button_new( _fooAdj[i], step, digits );
#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
gtk_widget_set_tooltip_text( _fooBtn[i], tips[i] );
#else
gtk_widget_set_tooltip_text( _fooBtn[i], "." );
#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2)
sp_dialog_defocus_on_enter( _fooBtn[i] );
gtk_label_set_mnemonic_widget( GTK_LABEL(_fooLabel[i]), _fooBtn[i] );
gtk_widget_show( _fooBtn[i] );
gtk_table_attach( GTK_TABLE (t), _fooBtn[i], 2, 3, row, row + 1, (GtkAttachOptions)0, (GtkAttachOptions)0, XPAD, YPAD );
//.........这里部分代码省略.........
开发者ID:Spin0za, 项目名称:inkscape, 代码行数:101, 代码来源:sp-color-icc-selector.cpp
示例6: create_windowMain
GtkWidget*
create_windowMain ()
{
GtkWidget *vbox1;
GtkWidget *hpaned1;
GtkWidget *scrolledwindow1;
GtkWidget *hbuttonbox1;
GtkWidget *buttonRefresh;
GtkWidget *buttonConfigure;
GtkWidget *buttonClose;
GtkWidget *buttonAbout;
GdkPixbuf *icon;
GtkCellRenderer *treeRenderer;
GtkTreeViewColumn *treeColumn;
windowMain = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_name (windowMain, "windowMain");
gtk_window_set_title (GTK_WINDOW (windowMain), "USB Viewer");
gtk_window_set_default_size (GTK_WINDOW (windowMain), 600, 300);
icon = gdk_pixbuf_new_from_xpm_data((const char **)usbview_icon);
gtk_window_set_icon(GTK_WINDOW(windowMain), icon);
vbox1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_name (vbox1, "vbox1");
gtk_widget_show (vbox1);
gtk_container_add (GTK_CONTAINER (windowMain), vbox1);
hpaned1 = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
gtk_widget_set_name (hpaned1, "hpaned1");
gtk_widget_show (hpaned1);
gtk_box_pack_start (GTK_BOX (vbox1), hpaned1, TRUE, TRUE, 0);
treeStore = gtk_tree_store_new (N_COLUMNS,
G_TYPE_STRING, /* NAME_COLUMN */
G_TYPE_INT, /* DEVICE_ADDR_COLUMN */
G_TYPE_STRING /* COLOR_COLUMN */);
treeUSB = gtk_tree_view_new_with_model (GTK_TREE_MODEL (treeStore));
treeRenderer = gtk_cell_renderer_text_new ();
treeColumn = gtk_tree_view_column_new_with_attributes (
"USB devices",
treeRenderer,
"text", NAME_COLUMN,
"foreground", COLOR_COLUMN,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (treeUSB), treeColumn);
gtk_widget_set_name (treeUSB, "treeUSB");
gtk_widget_show (treeUSB);
gtk_paned_pack1 (GTK_PANED (hpaned1), treeUSB, FALSE, FALSE);
scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_set_name (scrolledwindow1, "scrolledwindow1");
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
gtk_widget_show (scrolledwindow1);
gtk_paned_pack2 (GTK_PANED (hpaned1), scrolledwindow1, TRUE, FALSE);
textDescriptionBuffer = gtk_text_buffer_new(NULL);
//textDescription = gtk_text_new (NULL, NULL);
textDescriptionView = gtk_text_view_new_with_buffer(textDescriptionBuffer);
gtk_widget_set_name (textDescriptionView, "textDescription");
gtk_text_view_set_editable(GTK_TEXT_VIEW(textDescriptionView), FALSE);
gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(textDescriptionView), FALSE);
gtk_widget_show (textDescriptionView);
gtk_container_add (GTK_CONTAINER (scrolledwindow1), textDescriptionView);
hbuttonbox1 = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
gtk_widget_set_name (hbuttonbox1, "hbuttonbox1");
gtk_widget_show (hbuttonbox1);
gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox1, FALSE, FALSE, 5);
//gtk_button_box_set_spacing (GTK_BUTTON_BOX (hbuttonbox1), 10);
//gtk_button_box_set_child_size (GTK_BUTTON_BOX (hbuttonbox1), 50, 25);
//gtk_button_box_set_child_ipadding (GTK_BUTTON_BOX (hbuttonbox1), 25, 10);
buttonRefresh = gtk_button_new_with_label("Refresh");
gtk_widget_set_name (buttonRefresh, "buttonRefresh");
gtk_widget_show (buttonRefresh);
gtk_container_add (GTK_CONTAINER (hbuttonbox1), buttonRefresh);
gtk_container_set_border_width (GTK_CONTAINER (buttonRefresh), 4);
gtk_widget_set_can_default (buttonRefresh, TRUE);
buttonConfigure = gtk_button_new_with_label ("Configure...");
gtk_widget_set_name (buttonConfigure, "buttonConfigure");
gtk_widget_show (buttonConfigure);
gtk_container_add (GTK_CONTAINER (hbuttonbox1), buttonConfigure);
gtk_container_set_border_width (GTK_CONTAINER (buttonConfigure), 4);
gtk_widget_set_can_default (buttonConfigure, TRUE);
buttonAbout = gtk_button_new_with_label("About");
gtk_widget_set_name (buttonAbout, "buttonAbout");
gtk_widget_show (buttonAbout);
gtk_container_add (GTK_CONTAINER (hbuttonbox1), buttonAbout);
gtk_container_set_border_width (GTK_CONTAINER (buttonAbout), 4);
gtk_widget_set_can_default (buttonAbout, TRUE);
buttonClose = gtk_button_new_with_label("Quit");
gtk_widget_set_name (buttonClose, "buttonClose");
gtk_widget_show (buttonClose);
gtk_container_add (GTK_CONTAINER (hbuttonbox1), buttonClose);
gtk_container_set_border_width (GTK_CONTAINER (buttonClose), 4);
gtk_widget_set_can_default (buttonClose, TRUE);
//.........这里部分代码省略.........
开发者ID:gregkh, 项目名称:usbview, 代码行数:101, 代码来源:interface.c
示例7: gtkui_plugin_mgmt
/*
* plugin management
*/
void gtkui_plugin_mgmt(void)
{
GtkWidget *scrolled, *vbox;
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
DEBUG_MSG("gtk_plugin_mgmt");
/* if the object already exist, set the focus to it */
if (plugins_window) {
if(GTK_IS_WINDOW (plugins_window))
gtk_window_present(GTK_WINDOW (plugins_window));
else
gtkui_page_present(plugins_window);
return;
}
plugins_window = gtkui_page_new("Plugins", >kui_plug_destroy, >kui_plugins_detach);
vbox = gtk_vbox_new(FALSE, 0);
gtk_container_add(GTK_CONTAINER (plugins_window), vbox);
gtk_widget_show(vbox);
/* list */
scrolled = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scrolled), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW (scrolled), GTK_SHADOW_IN);
gtk_box_pack_start(GTK_BOX(vbox), scrolled, TRUE, TRUE, 0);
gtk_widget_show(scrolled);
treeview = gtk_tree_view_new();
gtk_container_add(GTK_CONTAINER (scrolled), treeview);
gtk_widget_show(treeview);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
g_signal_connect (G_OBJECT (treeview), "row_activated", G_CALLBACK (gtkui_select_plugin), NULL);
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes (" ", renderer, "text", 0, NULL);
gtk_tree_view_column_set_sort_column_id (column, 0);
gtk_tree_view_append_column (GTK_TREE_VIEW(treeview), column);
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes ("Name", renderer, "text", 1, NULL);
gtk_tree_view_column_set_sort_column_id (column, 1);
gtk_tree_view_append_column (GTK_TREE_VIEW(treeview), column);
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes ("Version", renderer, "text", 2, NULL);
gtk_tree_view_column_set_sort_column_id (column, 2);
gtk_tree_view_append_column (GTK_TREE_VIEW(treeview), column);
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes ("Info", renderer, "text", 3, NULL);
gtk_tree_view_column_set_sort_column_id (column, 3);
gtk_tree_view_append_column (GTK_TREE_VIEW(treeview), column);
/* create the array for the list widget */
/* or refreshes it if it exists */
gtkui_create_plug_array();
gtk_tree_view_set_model(GTK_TREE_VIEW (treeview), GTK_TREE_MODEL (ls_plugins));
gtk_widget_show(plugins_window);
}
开发者ID:LocutusOfBorg, 项目名称:Ettercap-NG, 代码行数:68, 代码来源:ec_gtk_plugins.c
示例8: destination_address
int destination_address(struct navit *nav)
{
GtkWidget *window2, *keyboard, *vbox, *table;
GtkWidget *label_country;
GtkWidget *label_postal, *label_city, *label_district;
GtkWidget *label_street, *label_number;
GtkWidget *hseparator1,*hseparator2;
GtkWidget *button1,*button2,*button3;
int i;
struct search_param *search=&search_param;
struct attr search_attr, country_name, *country_attr;
struct tracking *tracking;
struct country_search *cs;
struct item *item;
search->nav=nav;
search->ms=navit_get_mapset(nav);
search->sl=search_list_new(search->ms);
window2 = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window2),_("Enter Destination"));
gtk_window_set_wmclass (GTK_WINDOW (window2), "navit", "Navit");
vbox = gtk_vbox_new(FALSE, 0);
table = gtk_table_new(3, 8, FALSE);
search->entry_country = gtk_entry_new();
label_country = gtk_label_new(_("Country"));
search->entry_postal = gtk_entry_new();
gtk_widget_set_sensitive(GTK_WIDGET(search->entry_postal), FALSE);
label_postal = gtk_label_new(_("Zip Code"));
search->entry_city = gtk_entry_new();
label_city = gtk_label_new(_("City"));
search->entry_district = gtk_entry_new();
gtk_widget_set_sensitive(GTK_WIDGET(search->entry_district), FALSE);
label_district = gtk_label_new(_("District/Township"));
hseparator1 = gtk_vseparator_new();
search->entry_street = gtk_entry_new();
label_street = gtk_label_new(_("Street"));
search->entry_number = gtk_entry_new();
label_number = gtk_label_new(_("Number"));
search->treeview=gtk_tree_view_new();
search->listbox = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (search->listbox),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_tree_view_set_model (GTK_TREE_VIEW (search->treeview), NULL);
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(search->listbox),search->treeview);
{
GType types[COL_COUNT+1];
for(i=0;i<COL_COUNT;i++)
types[i]=G_TYPE_STRING;
types[i]=G_TYPE_POINTER;
search->liststore=gtk_list_store_newv(COL_COUNT+1,types);
search->liststore2=gtk_tree_model_sort_new_with_model(GTK_TREE_MODEL(search->liststore));
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (search->liststore2), 3, GTK_SORT_ASCENDING);
gtk_tree_view_set_model (GTK_TREE_VIEW (search->treeview), GTK_TREE_MODEL(search->liststore2));
}
hseparator2 = gtk_vseparator_new();
button1 = gtk_button_new_with_label(_("Map"));
button2 = gtk_button_new_with_label(_("Bookmark"));
button3 = gtk_button_new_with_label(_("Destination"));
gtk_table_attach(GTK_TABLE(table), label_country, 0, 1, 0, 1, 0, GTK_FILL, 0, 0);
gtk_table_attach(GTK_TABLE(table), label_postal, 1, 2, 0, 1, 0, GTK_FILL, 0, 0);
gtk_table_attach(GTK_TABLE(table), label_city, 2, 3, 0, 1, 0, GTK_FILL, 0, 0);
gtk_table_attach(GTK_TABLE(table), search->entry_country, 0, 1, 1, 2, 0, GTK_FILL, 0, 0);
gtk_table_attach(GTK_TABLE(table), search->entry_postal, 1, 2, 1, 2, 0, GTK_FILL, 0, 0);
gtk_table_attach(GTK_TABLE(table), search->entry_city, 2, 3, 1, 2, 0, GTK_FILL, 0, 0);
gtk_table_attach(GTK_TABLE(table), label_district, 0, 1, 2, 3, 0, GTK_FILL, 0, 0);
gtk_table_attach(GTK_TABLE(table), label_street, 1, 2, 2, 3, 0, GTK_FILL, 0, 0);
gtk_table_attach(GTK_TABLE(table), label_number, 2, 3, 2, 3, 0, GTK_FILL, 0, 0);
gtk_table_attach(GTK_TABLE(table), search->entry_district, 0, 1, 3, 4, 0, GTK_FILL, 0, 0);
gtk_table_attach(GTK_TABLE(table), search->entry_street, 1, 2, 3, 4, 0, GTK_FILL, 0, 0);
gtk_table_attach(GTK_TABLE(table), search->entry_number, 2, 3, 3, 4, 0, GTK_FILL, 0, 0);
gtk_table_attach(GTK_TABLE(table), search->listbox, 0, 3, 4, 5, GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 0, 0);
gtk_table_attach(GTK_TABLE(table), button1, 0, 1, 5, 6, GTK_FILL, GTK_FILL, 0, 0);
gtk_table_attach(GTK_TABLE(table), button2, 1, 2, 5, 6, GTK_FILL, GTK_FILL, 0, 0);
gtk_table_attach(GTK_TABLE(table), button3, 2, 3, 5, 6, GTK_FILL, GTK_FILL, 0, 0);
g_signal_connect(G_OBJECT(search->entry_country), "changed", G_CALLBACK(changed), search);
g_signal_connect(G_OBJECT(search->entry_postal), "changed", G_CALLBACK(changed), search);
g_signal_connect(G_OBJECT(search->entry_city), "changed", G_CALLBACK(changed), search);
g_signal_connect(G_OBJECT(search->entry_district), "changed", G_CALLBACK(changed), search);
g_signal_connect(G_OBJECT(search->entry_street), "changed", G_CALLBACK(changed), search);
g_signal_connect(G_OBJECT(search->entry_number), "changed", G_CALLBACK(changed), search);
g_signal_connect(G_OBJECT(button1), "clicked", G_CALLBACK(button_map), search);
g_signal_connect(G_OBJECT(button2), "clicked", G_CALLBACK(button_bookmark), search);
g_signal_connect(G_OBJECT(button3), "clicked", G_CALLBACK(button_destination), search);
g_signal_connect(G_OBJECT(search->treeview), "button-release-event", G_CALLBACK(tree_view_button_release), search);
//.........这里部分代码省略.........
开发者ID:justinzane, 项目名称:navit, 代码行数:101, 代码来源:destination.c
示例9: pidgin_xfer_dialog_update_xfer
void
pidgin_xfer_dialog_update_xfer(PidginXferDialog *dialog,
PurpleXfer *xfer)
{
PidginXferUiData *data;
char *size_str, *remaining_str;
GtkTreeSelection *selection;
time_t current_time;
GtkTreeIter iter;
gboolean valid;
g_return_if_fail(dialog != NULL);
g_return_if_fail(xfer != NULL);
if ((data = PIDGINXFER(xfer)) == NULL)
return;
if (data->in_list == FALSE)
return;
current_time = time(NULL);
if (((current_time - data->last_updated_time) == 0) &&
(!purple_xfer_is_completed(xfer)))
{
/* Don't update the window more than once per second */
return;
}
data->last_updated_time = current_time;
size_str = purple_str_size_to_units(purple_xfer_get_size(xfer));
remaining_str = purple_str_size_to_units(purple_xfer_get_bytes_remaining(xfer));
gtk_list_store_set(xfer_dialog->model, &data->iter,
COLUMN_PROGRESS, purple_xfer_get_progress(xfer),
COLUMN_SIZE, size_str,
COLUMN_REMAINING, remaining_str,
-1);
g_free(size_str);
g_free(remaining_str);
if (purple_xfer_is_completed(xfer))
{
GdkPixbuf *pixbuf;
pixbuf = gtk_widget_render_icon(dialog->window,
PIDGIN_STOCK_FILE_DONE,
GTK_ICON_SIZE_MENU, NULL);
gtk_list_store_set(GTK_LIST_STORE(xfer_dialog->model), &data->iter,
COLUMN_STATUS, pixbuf,
COLUMN_REMAINING, _("Finished"),
-1);
g_object_unref(pixbuf);
}
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(xfer_dialog->tree));
update_title_progress(dialog);
if (xfer == dialog->selected_xfer)
update_detailed_info(xfer_dialog, xfer);
if (purple_xfer_is_completed(xfer) && dialog->auto_clear)
pidgin_xfer_dialog_remove_xfer(dialog, xfer);
else
update_buttons(dialog, xfer);
/*
* If all transfers are finished, and the pref is set, then
* close the dialog. Otherwise just exit this function.
*/
if (dialog->keep_open)
return;
valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(dialog->model), &iter);
while (valid)
{
GValue val;
PurpleXfer *next;
val.g_type = 0;
gtk_tree_model_get_value(GTK_TREE_MODEL(dialog->model),
&iter, COLUMN_DATA, &val);
next = g_value_get_pointer(&val);
if (!purple_xfer_is_completed(next))
return;
valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(dialog->model), &iter);
}
/* If we got to this point then we know everything is finished */
pidgin_xfer_dialog_hide(dialog);
}
开发者ID:wosigh, 项目名称:messaging-plugins, 代码行数:95, 代码来源:gtkft.c
示例10: prefsbox_open
void
prefsbox_open (void)
{
GtkWidget *notebook;
GtkWidget *grid;
GtkWidget *controls_list;
GtkWidget *label;
GtkCellRenderer *renderer;
GtkListStore *model;
GtkTreeIter iter;
gint i;
if (prefsbox != NULL) {
gtk_window_present (GTK_WINDOW (prefsbox));
return;
}
prefsbox = gtk_dialog_new_with_buttons (_("Four-in-a-Row Preferences"),
GTK_WINDOW (app),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_CLOSE,
GTK_RESPONSE_ACCEPT, NULL);
gtk_container_set_border_width (GTK_CONTAINER (prefsbox), 5);
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (prefsbox))),
2);
g_signal_connect (G_OBJECT (prefsbox), "destroy",
G_CALLBACK (gtk_widget_destroyed), &prefsbox);
notebook = gtk_notebook_new ();
gtk_container_set_border_width (GTK_CONTAINER (notebook), 5);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (prefsbox))), notebook, TRUE, TRUE, 0);
/* game tab */
grid = gtk_grid_new ();
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
gtk_container_set_border_width (GTK_CONTAINER (grid), 12);
label = gtk_label_new (_("Game"));
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), grid, label);
label = gtk_label_new (_("Player One:"));
gtk_widget_set_hexpand (label, TRUE);
gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1);
combobox1 = gtk_combo_box_new ();
renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox1), renderer, TRUE);
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combobox1), renderer, "text", 0);
model = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
gtk_combo_box_set_model (GTK_COMBO_BOX (combobox1), GTK_TREE_MODEL (model));
gtk_list_store_append (model, &iter);
gtk_list_store_set (model, &iter, 0, _("Human"), 1, LEVEL_HUMAN, -1);
if (p.level[PLAYER1] == LEVEL_HUMAN)
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox1), &iter);
gtk_list_store_append (model, &iter);
gtk_list_store_set (model, &iter, 0, _("Level one"), 1, LEVEL_WEAK, -1);
if (p.level[PLAYER1] == LEVEL_WEAK)
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox1), &iter);
gtk_list_store_append (model, &iter);
gtk_list_store_set (model, &iter, 0, _("Level two"), 1, LEVEL_MEDIUM, -1);
if (p.level[PLAYER1] == LEVEL_MEDIUM)
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox1), &iter);
gtk_list_store_append (model, &iter);
gtk_list_store_set (model, &iter, 0, _("Level three"), 1, LEVEL_STRONG, -1);
if (p.level[PLAYER1] == LEVEL_STRONG)
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox1), &iter);
g_signal_connect (combobox1, "changed", G_CALLBACK (on_select_player1), NULL);
gtk_grid_attach (GTK_GRID (grid), combobox1, 1, 0, 1, 1);
label = gtk_label_new (_("Player Two:"));
gtk_grid_attach (GTK_GRID (grid), label, 0, 1, 1, 1);
combobox2 = gtk_combo_box_new ();
renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox2), renderer, TRUE);
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combobox2), renderer, "text", 0);
model = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT);
gtk_combo_box_set_model (GTK_COMBO_BOX (combobox2), GTK_TREE_MODEL (model));
gtk_list_store_append (model, &iter);
gtk_list_store_set (model, &iter, 0, _("Human"), 1, LEVEL_HUMAN, -1);
if (p.level[PLAYER2] == LEVEL_HUMAN)
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox2), &iter);
gtk_list_store_append (model, &iter);
gtk_list_store_set (model, &iter, 0, _("Level one"), 1, LEVEL_WEAK, -1);
if (p.level[PLAYER2] == LEVEL_WEAK)
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox2), &iter);
gtk_list_store_append (model, &iter);
gtk_list_store_set (model, &iter, 0, _("Level two"), 1, LEVEL_MEDIUM, -1);
if (p.level[PLAYER2] == LEVEL_MEDIUM)
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox2), &iter);
gtk_list_store_append (model, &iter);
gtk_list_store_set (model, &iter, 0, _("Level three"), 1, LEVEL_STRONG, -1);
if (p.level[PLAYER2] == LEVEL_STRONG)
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox2), &iter);
g_signal_connect (combobox2, "changed", G_CALLBACK (on_select_player2), NULL);
gtk_grid_attach (GTK_GRID (grid), combobox2, 1, 1, 1, 1);
//.........这里部分代码省略.........
开发者ID:Swetha5, 项目名称:gnome-games, 代码行数:101, 代码来源:prefs.c
示例11: BuildMenuDialog_construct
GtkWindow* BuildMenuDialog_construct(ModalDialog& modal, ProjectList& projectList)
{
GtkWindow* window = create_dialog_window(MainFrame_getWindow(), "Build Menu", G_CALLBACK(dialog_delete_callback), &modal, -1, 400);
GtkWidget* buildView = 0;
{
GtkTable* table1 = create_dialog_table(2, 2, 4, 4, 4);
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(table1));
{
GtkVBox* vbox = create_dialog_vbox(4);
gtk_table_attach(table1, GTK_WIDGET(vbox), 1, 2, 0, 1,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (GTK_FILL), 0, 0);
{
GtkButton* button = create_dialog_button("OK", G_CALLBACK(dialog_button_ok), &modal);
gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(button), FALSE, FALSE, 0);
}
{
GtkButton* button = create_dialog_button("Cancel", G_CALLBACK(dialog_button_cancel), &modal);
gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(button), FALSE, FALSE, 0);
}
}
{
GtkFrame* frame = create_dialog_frame("Build menu");
gtk_table_attach(table1, GTK_WIDGET(frame), 0, 1, 0, 1,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
{
GtkScrolledWindow* scr = create_scrolled_window(GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC, 4);
gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(scr));
{
GtkListStore* store = gtk_list_store_new(1, G_TYPE_STRING);
GtkWidget* view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE);
GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
object_set_boolean_property(G_OBJECT(renderer), "editable", TRUE);
g_signal_connect(renderer, "edited", G_CALLBACK(project_cell_edited), &projectList);
GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes("", renderer, "text", 0, 0);
gtk_tree_view_append_column(GTK_TREE_VIEW(view), column);
GtkTreeSelection* selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
gtk_tree_selection_set_mode(selection, GTK_SELECTION_BROWSE);
gtk_widget_show(view);
buildView = view;
projectList.m_store = store;
gtk_container_add(GTK_CONTAINER (scr), view);
g_signal_connect(G_OBJECT(view), "key_press_event", G_CALLBACK(project_key_press), &projectList);
g_object_unref(G_OBJECT(store));
}
}
}
{
GtkFrame* frame = create_dialog_frame("Commandline");
gtk_table_attach(table1, GTK_WIDGET(frame), 0, 1, 1, 2,
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
{
GtkScrolledWindow* scr = create_scrolled_window(GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC, 4);
gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(scr));
{
GtkListStore* store = gtk_list_store_new(1, G_TYPE_STRING);
GtkWidget* view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(view), FALSE);
GtkCellRenderer* renderer = gtk_cell_renderer_text_new();
object_set_boolean_property(G_OBJECT(renderer), "editable", TRUE);
g_signal_connect(renderer, "edited", G_CALLBACK(commands_cell_edited), store);
GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes("", renderer, "text", 0, 0);
gtk_tree_view_append_column(GTK_TREE_VIEW(view), column);
GtkTreeSelection* selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(view));
gtk_tree_selection_set_mode(selection, GTK_SELECTION_BROWSE);
gtk_widget_show(view);
gtk_container_add(GTK_CONTAINER (scr), view);
g_object_unref(G_OBJECT(store));
g_signal_connect(G_OBJECT(view), "key_press_event", G_CALLBACK(commands_key_press), store);
g_signal_connect(G_OBJECT(gtk_tree_view_get_selection(GTK_TREE_VIEW(buildView))), "changed", G_CALLBACK(project_selection_changed), store);
}
}
}
}
BSPCommandList_Construct(projectList.m_store, g_build_project);
//.........这里部分代码省略.........
开发者ID:raynorpat, 项目名称:cake, 代码行数:101, 代码来源:build.cpp
示例12: greeter_custom_set_session
/*
* This function sets the custom list when the session list has changed in
* the session dialog (launched from session button or F10 menu).
*/
void
greeter_custom_set_session (gchar *session)
{
GList *tmp;
int i=0;
/*
* Since the sessions are created before the session list is generated,
* keep track of the session and set active row when it is setup. This
* function will get a NULL when the session is initialized to NULL
* at startup, so just return.
*/
if (session == NULL)
return;
else
{
/*
* If the session_widget hasn't been setup yet (which it won't be when
* the greeter_sessioninit function is called, then just store the
* session and we'll set the value when the combo box is initialized later.
*/
g_free (session_key);
session_key = g_strdup (session);
}
/* Do nothing if there is no session widget */
if (session_widget == NULL)
return;
/* Last isn't in the session list, so handle separate. */
if (strcmp (session, LAST_SESSION) == 0)
{
if (GTK_IS_COMBO_BOX (session_widget))
{
gtk_combo_box_set_active (GTK_COMBO_BOX (session_widget), 0);
}
else if (GTK_IS_SCROLLED_WINDOW (session_widget) &&
GTK_IS_TREE_VIEW (GTK_BIN (session_widget)->child))
{
GtkTreeView *tv = GTK_TREE_VIEW (GTK_BIN (session_widget)->child);
GtkTreeModel *tm = gtk_tree_view_get_model (tv);
GtkTreeSelection *selection = gtk_tree_view_get_selection (tv);
GtkTreeIter loopiter;
if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (tm), &loopiter))
gtk_tree_selection_select_iter (selection, &loopiter);
}
}
/*
* Handle for either combo box or list style, depending on which is being
* used.
. */
if (GTK_IS_COMBO_BOX (session_widget))
{
for (tmp = sessions; tmp != NULL; tmp = tmp->next)
{
char *file;
i++;
file = tmp->data;
if (strcmp (session, file) == 0)
{
gtk_combo_box_set_active (GTK_COMBO_BOX (session_widget), i);
break;
}
}
}
else if (GTK_IS_SCROLLED_WINDOW (session_widget) &&
GTK_IS_TREE_VIEW (GTK_BIN (session_widget)->child))
{
GtkTreeView *tv = GTK_TREE_VIEW (GTK_BIN (session_widget)->child);
GtkTreeModel *tm = gtk_tree_view_get_model (tv);
GtkTreeSelection *selection = gtk_tree_view_get_selection (tv);
GtkTreeIter loopiter;
if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (tm), &loopiter))
{
do
{
char *file;
gtk_tree_model_get (GTK_TREE_MODEL (tm), &loopiter, GREETER_LIST_ID, &file, -1);
if (file != NULL && strcmp (session, file) == 0)
{
GtkTreePath *path = gtk_tree_model_get_path (tm, &loopiter);
gtk_tree_selection_select_iter (selection, &loopiter);
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (tv),
path, NULL,
FALSE, 0.0, 0.0);
gtk_tree_path_free (path);
break;
}
} while (gtk_tree_model_iter_next (GTK_TREE_MODEL (tm), &loopiter));
}
//.........这里部分代码省略.........
开发者ID:3dfxmadscientist, 项目名称:mdm, 代码行数:101, 代码来源:greeter_item_customlist.c
六六分期app的软件客服如何联系?不知道吗?加qq群【895510560】即可!标题:六六分期
阅读:18285| 2023-10-27
今天小编告诉大家如何处理win10系统火狐flash插件总是崩溃的问题,可能很多用户都不知
阅读:9681| 2022-11-06
今天小编告诉大家如何对win10系统删除桌面回收站图标进行设置,可能很多用户都不知道
阅读:8180| 2022-11-06
今天小编告诉大家如何对win10系统电脑设置节能降温的设置方法,想必大家都遇到过需要
阅读:8551| 2022-11-06
我们在使用xp系统的过程中,经常需要对xp系统无线网络安装向导设置进行设置,可能很多
阅读:8458| 2022-11-06
今天小编告诉大家如何处理win7系统玩cf老是与主机连接不稳定的问题,可能很多用户都不
阅读:9395| 2022-11-06
电脑对日常生活的重要性小编就不多说了,可是一旦碰到win7系统设置cf烟雾头的问题,很
阅读:8431| 2022-11-06
我们在日常使用电脑的时候,有的小伙伴们可能在打开应用的时候会遇见提示应用程序无法
阅读:7866| 2022-11-06
今天小编告诉大家如何对win7系统打开vcf文件进行设置,可能很多用户都不知道怎么对win
阅读:8416| 2022-11-06
今天小编告诉大家如何对win10系统s4开启USB调试模式进行设置,可能很多用户都不知道怎
阅读:7394| 2022-11-06
请发表评论