本文整理汇总了C++中GTK_LIST_STORE函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_LIST_STORE函数的具体用法?C++ GTK_LIST_STORE怎么用?C++ GTK_LIST_STORE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_LIST_STORE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: gnc_account_select_combo_fill
Account *
gnc_account_select_combo_fill (GtkWidget *combo, QofBook *book,
GList *acct_types, GList *acct_commodities)
{
GtkListStore *store;
GtkTreeIter iter;
GList *list, *node;
const gchar *text;
g_return_val_if_fail (combo && GTK_IS_COMBO_BOX(combo), NULL);
g_return_val_if_fail (book, NULL);
g_return_val_if_fail (acct_types, NULL);
/* Figure out if anything is set in the combo */
text = gtk_entry_get_text(GTK_ENTRY (gtk_bin_get_child(GTK_BIN (GTK_COMBO_BOX(combo)))));
g_object_set_data (G_OBJECT(combo), "book", book);
list = gnc_account_get_descendants (gnc_book_get_root_account (book));
/* Clear the existing list */
store = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(combo)));
gtk_list_store_clear(store);
/* Add the account names to the combo box */
for (node = list; node; node = node->next)
{
Account *account = node->data;
char *name;
/* Only present accounts of the appropriate type */
if (g_list_index (acct_types, (gpointer)xaccAccountGetType (account))
== -1)
continue;
/* Only present accounts with the right commodity, if that's a
restriction */
if (acct_commodities)
{
if ( g_list_find_custom( acct_commodities,
GINT_TO_POINTER(xaccAccountGetCommodity(account)),
gnc_commodity_compare_void) == NULL )
{
continue;
}
}
name = gnc_account_get_full_name (account);
gtk_list_store_append(store, &iter);
gtk_list_store_set (store, &iter, 0, name, -1);
/* Save the first account name in case no account name was set */
if (!text || g_strcmp0 (text, "") == 0)
{
text = g_strdup (name);
}
g_free(name);
}
gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0);
g_list_free (list);
gnc_cbwe_set_by_string(GTK_COMBO_BOX(combo), text);
return gnc_account_select_combo_get_active (combo);
}
开发者ID:Gnucash,项目名称:gnucash,代码行数:65,代码来源:business-gnome-utils.c
示例2: bmd_cell_edited
void
bmd_cell_edited (GtkCellRendererText *cell,
const gchar *path_string,
const gchar *new_text,
gpointer data)
{
GtkTreeModel *model = (GtkTreeModel *) data;
GtkTreePath *path = gtk_tree_path_new_from_string (path_string);
GtkTreeIter iter;
gint column = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell), "column"));
gtk_tree_model_get_iter (model, &iter, path);
switch (column) {
case COLUMN_ITEM_NUMBER: {
gint i;
i = gtk_tree_path_get_indices (path) [0];
g_array_index (articles, Item, i).number = atoi (new_text);
gtk_list_store_set (GTK_LIST_STORE (model), &iter, column,
g_array_index (articles, Item, i).number, -1);
}
break;
case COLUMN_ITEM_TITLE: {
gint i;
gchar *old_text;
gtk_tree_model_get (model, &iter, column, &old_text, -1);
g_free (old_text);
i = gtk_tree_path_get_indices (path) [0];
g_free (g_array_index (articles, Item, i).title);
g_array_index (articles, Item, i).title = g_strdup (new_text);
gtk_list_store_set (GTK_LIST_STORE (model), &iter, column,
g_array_index (articles, Item, i).title, -1);
}
break;
case COLUMN_ITEM_AUTHOR: {
gint i;
gchar *old_text;
gtk_tree_model_get (model, &iter, column, &old_text, -1);
g_free (old_text);
i = gtk_tree_path_get_indices (path) [0];
g_free (g_array_index (articles, Item, i).author);
g_array_index (articles, Item, i).author = g_strdup (new_text);
gtk_list_store_set (GTK_LIST_STORE (model), &iter, column,
g_array_index (articles, Item, i).author, -1);
}
break;
case COLUMN_ITEM_PAGES: {
gint i;
i = gtk_tree_path_get_indices (path) [0];
g_array_index (articles, Item, i).pages = atoi (new_text);
gtk_list_store_set (GTK_LIST_STORE (model), &iter, column,
g_array_index (articles, Item, i).pages, -1);
}
break;
}
gtk_tree_path_free (path);
}
开发者ID:mhorauer,项目名称:GTK-Demo-Examples,代码行数:73,代码来源:bmd_editable_cells_callbacks.c
示例3: repopulate
static void
repopulate (void)
{
CajaBookmark *selected;
GtkListStore *store;
GtkTreePath *path;
GtkTreeRowReference *reference;
guint index;
g_assert (GTK_IS_TREE_VIEW (bookmark_list_widget));
g_assert (CAJA_IS_BOOKMARK_LIST (bookmarks));
store = GTK_LIST_STORE (bookmark_list_store);
selected = get_selected_bookmark ();
g_signal_handler_block (bookmark_selection,
selection_changed_id);
g_signal_handler_block (bookmark_list_store,
row_deleted_signal_id);
g_signal_handler_block (bookmark_list_widget,
row_activated_signal_id);
g_signal_handler_block (bookmark_list_widget,
key_pressed_signal_id);
g_signal_handler_block (bookmark_list_widget,
button_pressed_signal_id);
gtk_list_store_clear (store);
g_signal_handler_unblock (bookmark_list_widget,
row_activated_signal_id);
g_signal_handler_unblock (bookmark_list_widget,
key_pressed_signal_id);
g_signal_handler_unblock (bookmark_list_widget,
button_pressed_signal_id);
g_signal_handler_unblock (bookmark_list_store,
row_deleted_signal_id);
g_signal_handler_unblock (bookmark_selection,
selection_changed_id);
/* Fill the list in with the bookmark names. */
g_signal_handler_block (store, row_changed_signal_id);
reference = NULL;
for (index = 0; index < caja_bookmark_list_length (bookmarks); ++index)
{
CajaBookmark *bookmark;
char *bookmark_name;
GdkPixbuf *bookmark_pixbuf;
GtkTreeIter iter;
bookmark = caja_bookmark_list_item_at (bookmarks, index);
bookmark_name = caja_bookmark_get_name (bookmark);
bookmark_pixbuf = caja_bookmark_get_pixbuf (bookmark, GTK_ICON_SIZE_MENU);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter,
BOOKMARK_LIST_COLUMN_ICON, bookmark_pixbuf,
BOOKMARK_LIST_COLUMN_NAME, bookmark_name,
BOOKMARK_LIST_COLUMN_BOOKMARK, bookmark,
BOOKMARK_LIST_COLUMN_STYLE, PANGO_STYLE_NORMAL,
-1);
if (bookmark == selected)
{
/* save old selection */
GtkTreePath *path;
path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), &iter);
reference = gtk_tree_row_reference_new (GTK_TREE_MODEL (store), path);
gtk_tree_path_free (path);
}
g_free (bookmark_name);
g_object_unref (bookmark_pixbuf);
}
g_signal_handler_unblock (store, row_changed_signal_id);
if (reference != NULL)
{
/* restore old selection */
/* bookmarks_set_empty() will call the selection change handler,
* so we block it here in case of selection change.
*/
g_signal_handler_block (bookmark_selection, selection_changed_id);
g_assert (index != 0);
g_assert (gtk_tree_row_reference_valid (reference));
path = gtk_tree_row_reference_get_path (reference);
gtk_tree_selection_select_path (bookmark_selection, path);
gtk_tree_row_reference_free (reference);
gtk_tree_path_free (path);
g_signal_handler_unblock (bookmark_selection, selection_changed_id);
}
//.........这里部分代码省略.........
开发者ID:eyelash,项目名称:caja,代码行数:101,代码来源:caja-bookmarks-window.c
示例4: refresh_list
static void
refresh_list (PlumaDocumentsPanel *panel)
{
/* TODO: refresh the list only if the panel is visible */
GList *tabs;
GList *l;
GtkWidget *nb;
GtkListStore *list_store;
PlumaTab *active_tab;
/* g_debug ("refresh_list"); */
list_store = GTK_LIST_STORE (panel->priv->model);
gtk_list_store_clear (list_store);
active_tab = pluma_window_get_active_tab (panel->priv->window);
nb = _pluma_window_get_notebook (panel->priv->window);
tabs = gtk_container_get_children (GTK_CONTAINER (nb));
l = tabs;
panel->priv->adding_tab = TRUE;
while (l != NULL)
{
GdkPixbuf *pixbuf;
gchar *name;
GtkTreeIter iter;
name = tab_get_name (PLUMA_TAB (l->data));
pixbuf = _pluma_tab_get_icon (PLUMA_TAB (l->data));
/* Add a new row to the model */
gtk_list_store_append (list_store, &iter);
gtk_list_store_set (list_store,
&iter,
PIXBUF_COLUMN, pixbuf,
NAME_COLUMN, name,
TAB_COLUMN, l->data,
-1);
g_free (name);
if (pixbuf != NULL)
g_object_unref (pixbuf);
if (l->data == active_tab)
{
GtkTreeSelection *selection;
selection = gtk_tree_view_get_selection (
GTK_TREE_VIEW (panel->priv->treeview));
gtk_tree_selection_select_iter (selection, &iter);
}
l = g_list_next (l);
}
panel->priv->adding_tab = FALSE;
g_list_free (tabs);
}
开发者ID:fatman2021,项目名称:pluma,代码行数:65,代码来源:pluma-documents-panel.c
示例5: loadKeymap
void loadKeymap(GtkListStore *model) {
DIR *kbdir = NULL;
struct dirent *entry;
GtkTreeIter iter;
gint count = 0;
GtkTreePath *path;
gint ipath = 0, ipath_en = 1;
/* fill the list */
kbdir = opendir(KBPATH);
if(kbdir == NULL) {
// gnome_warning_dialog(g_strdup_printf(
// _("Unable to find keyboad definitions: %s"),
// KBPATH));
l_message_dialog(GTK_MESSAGE_WARNING,
g_strdup_printf(_("Unable to find keyboad definitions: %s"),
KBPATH));
}
if(kbdir != NULL) {
while((entry = readdir(kbdir)) != NULL) {
if(entry->d_name[0] == '.')
continue;
if(!l_strcasecmp(entry->d_name, "common"))
continue;
if(!l_strcasecmp(entry->d_name, "modifiers"))
continue;
gtk_list_store_append(GTK_LIST_STORE(model), &iter);
gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0,
g_strdup(g_ascii_strup(entry->d_name, -1)), -1);
count++;
if(SHASH("keymap") != NULL) {
if(!l_strcasecmp(SHASH("keymap"), entry->d_name))
ipath = count;
}
if(!l_strcasecmp("EN", entry->d_name))
ipath_en = count;
}
}
if(kbdir != NULL)
closedir(kbdir);
if(count <= 0) {
g_warning(_("Unable to find keyboad definitions: %s"),
KBPATH);
gtk_list_store_append(GTK_LIST_STORE(model), &iter);
gtk_list_store_set(GTK_LIST_STORE(model), &iter, 0,
g_strdup("EN"), -1);
}
if(SHASH("keymap") != NULL) {
path = gtk_tree_path_new_from_string(
g_strdup_printf("%d", (ipath > 0) ? ipath-1 : ipath_en-1));
if(path != NULL) {
gtk_tree_view_set_cursor(GTK_TREE_VIEW(tree_keymap),
path, NULL, FALSE);
}
} else {
path = gtk_tree_path_new_from_string(
g_strdup_printf("%d", ipath_en-1));
if(path != NULL) {
gtk_tree_view_set_cursor(GTK_TREE_VIEW(tree_keymap),
path, NULL, FALSE);
}
}
return;
}
开发者ID:AKMergl,项目名称:gRDesktop,代码行数:72,代码来源:options.c
示例6: totem_open_location_new
GtkWidget *
totem_open_location_new (void)
{
TotemOpenLocation *open_location;
char *clipboard_location;
GtkEntryCompletion *completion;
GtkTreeModel *model;
GList *recent_items, *streams_recent_items = NULL;
open_location = TOTEM_OPEN_LOCATION (g_object_new (TOTEM_TYPE_OPEN_LOCATION,
"use-header-bar", 1, NULL));
if (open_location->priv->uri_container == NULL) {
g_object_unref (open_location);
return NULL;
}
gtk_window_set_title (GTK_WINDOW (open_location), _("Add Web Video"));
gtk_dialog_add_buttons (GTK_DIALOG (open_location),
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_Add"), GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_response_sensitive (GTK_DIALOG (open_location), GTK_RESPONSE_OK, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (open_location), 5);
gtk_dialog_set_default_response (GTK_DIALOG (open_location), GTK_RESPONSE_OK);
/* Get item from clipboard to fill GtkEntry */
clipboard_location = totem_open_location_set_from_clipboard (open_location);
if (clipboard_location != NULL && strcmp (clipboard_location, "") != 0)
gtk_entry_set_text (open_location->priv->uri_entry, clipboard_location);
g_free (clipboard_location);
/* Add items in Totem's GtkRecentManager to the URI GtkEntry's GtkEntryCompletion */
completion = gtk_entry_completion_new();
model = GTK_TREE_MODEL (gtk_list_store_new (1, G_TYPE_STRING));
gtk_entry_set_completion (open_location->priv->uri_entry, completion);
recent_items = gtk_recent_manager_get_items (gtk_recent_manager_get_default ());
if (recent_items != NULL)
{
GList *p;
GtkTreeIter iter;
/* Filter out non-Totem items */
for (p = recent_items; p != NULL; p = p->next)
{
GtkRecentInfo *info = (GtkRecentInfo *) p->data;
if (!gtk_recent_info_has_group (info, "TotemStreams")) {
gtk_recent_info_unref (info);
continue;
}
streams_recent_items = g_list_prepend (streams_recent_items, info);
}
streams_recent_items = g_list_sort (streams_recent_items, (GCompareFunc) totem_compare_recent_stream_items);
/* Populate the list store for the combobox */
for (p = streams_recent_items; p != NULL; p = p->next)
{
GtkRecentInfo *info = (GtkRecentInfo *) p->data;
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, gtk_recent_info_get_uri (info), -1);
gtk_recent_info_unref (info);
}
g_list_free (streams_recent_items);
}
g_list_free (recent_items);
gtk_entry_completion_set_model (completion, model);
gtk_entry_completion_set_text_column (completion, 0);
gtk_entry_completion_set_match_func (completion, (GtkEntryCompletionMatchFunc) totem_open_location_match, model, NULL);
gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (open_location))),
open_location->priv->uri_container,
TRUE, /* expand */
TRUE, /* fill */
0); /* padding */
gtk_widget_show_all (gtk_dialog_get_content_area (GTK_DIALOG (open_location)));
return GTK_WIDGET (open_location);
}
开发者ID:Avinashkumarsharma,项目名称:totem,代码行数:85,代码来源:totem-open-location.c
示例7: on_combo_change
static void on_combo_change( GtkComboBox* combo, gpointer user_data )
{
GtkTreeIter it;
if( gtk_combo_box_get_active_iter(combo, &it) )
{
const char* action;
GtkTreeModel* model = gtk_combo_box_get_model( combo );
gtk_tree_model_get( model, &it, 2, &action, -1 );
if( ! action )
{
char* action;
GtkWidget* parent;
VFSMimeType* mime = (VFSMimeType*)user_data;
parent = gtk_widget_get_toplevel( GTK_WIDGET( combo ) );
action = (char *) ptk_choose_app_for_mime_type( GTK_WINDOW(parent),
mime, FALSE, TRUE, TRUE, TRUE );
if( action )
{
gboolean exist = FALSE;
/* check if the action is already in the list */
if( gtk_tree_model_get_iter_first( model, &it ) )
{
do
{
char* tmp;
gtk_tree_model_get( model, &it, 2, &tmp, -1 );
if( !tmp )
continue;
if( 0 == strcmp( tmp, action ) )
{
exist = TRUE;
g_free( tmp );
break;
}
g_free( tmp );
} while( gtk_tree_model_iter_next( model, &it ) );
}
if( ! exist ) /* It didn't exist */
{
VFSAppDesktop* app = vfs_app_desktop_new( action );
if( app )
{
GdkPixbuf* icon;
icon = vfs_app_desktop_get_icon( app, 20, TRUE );
gtk_list_store_insert_with_values(
GTK_LIST_STORE( model ), &it, 0,
0, icon,
1, vfs_app_desktop_get_disp_name(app),
2, action, -1 );
if( icon )
g_object_unref( icon );
vfs_app_desktop_unref( app );
exist = TRUE;
}
}
if( exist )
gtk_combo_box_set_active_iter( combo, &it );
g_free( action );
}
else
{
int prev_sel;
prev_sel = GPOINTER_TO_INT( g_object_get_data( G_OBJECT(combo), "prev_sel") );
gtk_combo_box_set_active( combo, prev_sel );
}
}
else
{
int prev_sel = gtk_combo_box_get_active( combo );
g_object_set_data( G_OBJECT(combo), "prev_sel", GINT_TO_POINTER(prev_sel) );
}
}
else
{
g_object_set_data( G_OBJECT(combo), "prev_sel", GINT_TO_POINTER(-1) );
}
}
开发者ID:Twottitdo,项目名称:spacefm,代码行数:79,代码来源:ptk-file-properties.c
示例8: tny_gtk_attach_list_model_add
static void
tny_gtk_attach_list_model_add (TnyGtkAttachListModel *self, TnyMimePart *part, listaddfunc func)
{
GtkListStore *model = GTK_LIST_STORE (self);
GtkTreeIter iter;
TnyGtkAttachListModelPriv *priv = TNY_GTK_ATTACH_LIST_MODEL_GET_PRIVATE (self);
static GdkPixbuf *stock_file_pixbuf = NULL;
GdkPixbuf *pixbuf;
gchar *icon;
if (tny_mime_part_get_content_type (part) &&
tny_mime_part_is_attachment (part))
{
if (!priv->theme || !GTK_IS_ICON_THEME (priv->theme))
{
priv->theme = gtk_icon_theme_get_default ();
g_object_ref (priv->theme);
}
#ifdef GNOME
if (priv->theme && GTK_IS_ICON_THEME (priv->theme))
{
icon = gnome_icon_lookup (priv->theme, NULL,
tny_mime_part_get_filename (part), NULL, NULL,
tny_mime_part_get_content_type (part), 0, NULL);
}
#else
icon = GTK_STOCK_FILE;
#endif
if (G_LIKELY (icon) && priv->theme && GTK_IS_ICON_THEME (priv->theme))
{
pixbuf = gtk_icon_theme_load_icon (priv->theme, icon,
GTK_ICON_SIZE_LARGE_TOOLBAR, 0, NULL);
#ifdef GNOME
g_free (icon);
#endif
} else {
if (G_UNLIKELY (!stock_file_pixbuf) && priv->theme && GTK_IS_ICON_THEME (priv->theme))
stock_file_pixbuf = gtk_icon_theme_load_icon (priv->theme,
GTK_STOCK_FILE, GTK_ICON_SIZE_LARGE_TOOLBAR,
0, NULL);
pixbuf = stock_file_pixbuf;
}
func (model, &iter);
gtk_list_store_set (model, &iter,
TNY_GTK_ATTACH_LIST_MODEL_PIXBUF_COLUMN,
pixbuf,
TNY_GTK_ATTACH_LIST_MODEL_FILENAME_COLUMN,
tny_mime_part_get_filename (part),
TNY_GTK_ATTACH_LIST_MODEL_INSTANCE_COLUMN,
part, -1);
} else {
func (model, &iter);
gtk_list_store_set (model, &iter,
TNY_GTK_ATTACH_LIST_MODEL_FILENAME_COLUMN,
tny_mime_part_get_description (part)?
tny_mime_part_get_description (part):
"Unknown attachment",
TNY_GTK_ATTACH_LIST_MODEL_INSTANCE_COLUMN,
part, -1);
}
return;
}
开发者ID:Codeminded,项目名称:tinymail,代码行数:71,代码来源:tny-gtk-attach-list-model.c
示例9: show_track_properties_dlg
void
show_track_properties_dlg (int ctx, ddb_playlist_t *plt) {
last_ctx = ctx;
deadbeef->plt_ref (plt);
if (last_plt) {
deadbeef->plt_unref (last_plt);
}
last_plt = plt;
trkproperties_free_track_list (&tracks, &numtracks);
trkproperties_build_track_list_for_ctx (plt, ctx, &tracks, &numtracks);
GtkTreeView *tree;
GtkTreeView *proptree;
if (!trackproperties) {
trackproperties = create_trackproperties ();
gtk_window_set_transient_for (GTK_WINDOW (trackproperties), GTK_WINDOW (mainwin));
wingeom_restore (trackproperties, "trkproperties", -1, -1, 300, 400, 0);
// metadata tree
tree = GTK_TREE_VIEW (lookup_widget (trackproperties, "metalist"));
store = gtk_list_store_new (5, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, G_TYPE_STRING);
gtk_tree_view_set_model (tree, GTK_TREE_MODEL (store));
GtkCellRenderer *rend_text = gtk_cell_renderer_text_new ();
rend_text2 = GTK_CELL_RENDERER (ddb_cell_renderer_text_multiline_new ());
g_signal_connect ((gpointer)rend_text2, "edited",
G_CALLBACK (on_metadata_edited),
store);
GtkTreeViewColumn *col1 = gtk_tree_view_column_new_with_attributes (_("Key"), rend_text, "text", 0, NULL);
GtkTreeViewColumn *col2 = gtk_tree_view_column_new_with_attributes (_("Value"), rend_text2, "text", 1, NULL);
//gtk_tree_view_column_set_cell_data_func (col2, rend_text2, meta_value_transform_func, NULL, NULL);
gtk_tree_view_append_column (tree, col1);
gtk_tree_view_append_column (tree, col2);
// properties tree
proptree = GTK_TREE_VIEW (lookup_widget (trackproperties, "properties"));
propstore = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_STRING);
gtk_tree_view_set_model (proptree, GTK_TREE_MODEL (propstore));
GtkCellRenderer *rend_propkey = gtk_cell_renderer_text_new ();
GtkCellRenderer *rend_propvalue = gtk_cell_renderer_text_new ();
g_object_set (G_OBJECT (rend_propvalue), "editable", TRUE, NULL);
col1 = gtk_tree_view_column_new_with_attributes (_("Key"), rend_propkey, "text", 0, NULL);
col2 = gtk_tree_view_column_new_with_attributes (_("Value"), rend_propvalue, "text", 1, NULL);
gtk_tree_view_append_column (proptree, col1);
gtk_tree_view_append_column (proptree, col2);
}
else {
tree = GTK_TREE_VIEW (lookup_widget (trackproperties, "metalist"));
store = GTK_LIST_STORE (gtk_tree_view_get_model (tree));
gtk_list_store_clear (store);
proptree = GTK_TREE_VIEW (lookup_widget (trackproperties, "properties"));
propstore = GTK_LIST_STORE (gtk_tree_view_get_model (proptree));
gtk_list_store_clear (propstore);
}
if (numtracks == 1) {
deadbeef->pl_lock ();
gtk_entry_set_text (GTK_ENTRY (lookup_widget (trackproperties, "filename")), deadbeef->pl_find_meta_raw (tracks[0], ":URI"));
deadbeef->pl_unlock ();
}
else {
gtk_entry_set_text (GTK_ENTRY (lookup_widget (trackproperties, "filename")), _("[Multiple values]"));
}
g_object_set (G_OBJECT (rend_text2), "editable", TRUE, NULL);
GtkWidget *widget = trackproperties;
GtkWidget *w;
const char *meta;
trkproperties_fill_metadata ();
gtk_widget_set_sensitive (lookup_widget (widget, "write_tags"), TRUE);
gtk_widget_show (widget);
gtk_window_present (GTK_WINDOW (widget));
}
开发者ID:Alexey-Yakovenko,项目名称:deadbeef,代码行数:80,代码来源:trkproperties.c
示例10: GTK_TREE_VIEW
void
on_trkproperties_crop_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
GtkTreeView *treeview = GTK_TREE_VIEW (lookup_widget (trackproperties, "metalist"));
if (!gtk_widget_is_focus(GTK_WIDGET (treeview))) {
return; // do not remove field if Metadata tab is not focused
}
GtkTreePath *path;
gtk_tree_view_get_cursor (treeview, &path, NULL);
if (!path) {
return;
}
GtkTreeIter iter_curr;
gtk_tree_model_get_iter (GTK_TREE_MODEL (store), &iter_curr, path);
GtkTreeModel *model = gtk_tree_view_get_model (treeview);
GtkTreeIter iter;
GtkTreeIter next;
gboolean res = gtk_tree_model_get_iter_first (model, &iter);
while (res) {
int getnext = 1;
GtkTreePath *iter_path = gtk_tree_model_get_path (model, &iter);
if (gtk_tree_path_compare (path, iter_path)) {
GValue key = {0,};
gtk_tree_model_get_value (model, &iter, 2, &key);
const char *skey = g_value_get_string (&key);
GValue value = {0,};
gtk_tree_model_get_value (GTK_TREE_MODEL (store), &iter, 2, &value);
const char *svalue = g_value_get_string (&value);
// delete unknown fields completely; otherwise just clear
int i = 0;
for (; trkproperties_types[i]; i += 2) {
if (!strcasecmp (svalue, trkproperties_types[i])) {
break;
}
}
if (trkproperties_types[i]) { // known val, clear
gtk_list_store_set (store, &iter, 1, "", 3, 0, 4, "", -1);
}
else {
gtk_list_store_remove (store, &iter);
getnext = 0;
if (!gtk_list_store_iter_is_valid (GTK_LIST_STORE (model), &iter)) {
res = 0;
}
}
}
gtk_tree_path_free (iter_path);
if (getnext) {
res = gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter);
}
}
gtk_tree_view_set_cursor (treeview, path, NULL, FALSE); // restore cursor after deletion
gtk_tree_path_free (path);
trkproperties_modified = 1;
}
开发者ID:Alexey-Yakovenko,项目名称:deadbeef,代码行数:63,代码来源:trkproperties.c
示例11: bar_exif_update
static void bar_exif_update(ExifBar *eb)
{
ExifData *exif;
gint len, i;
exif = exif_read(eb->path, FALSE);
if (!exif)
{
bar_exif_sensitive(eb, FALSE);
return;
}
bar_exif_sensitive(eb, TRUE);
if (GTK_WIDGET_VISIBLE(eb->scrolled))
{
GList *list;
len = bar_exif_key_count;
for (i = 0; i < len; i++)
{
gchar *text;
text = exif_get_data_as_text(exif, bar_exif_key_list[i]);
text = bar_exif_validate_text(text);
gtk_label_set_text(GTK_LABEL(eb->labels[i]), text);
g_free(text);
}
list = g_list_last(history_list_get_by_key("exif_extras"));
if (list)
{
gtk_widget_show(eb->custom_sep);
}
else
{
gtk_widget_hide(eb->custom_sep);
}
i = 0;
while (list && i < EXIF_BAR_CUSTOM_COUNT)
{
gchar *text;
gchar *name;
gchar *buf;
name = list->data;
list = list->prev;
text = exif_get_data_as_text(exif, name);
text = bar_exif_validate_text(text);
buf = g_strconcat(name, ":", NULL);
gtk_label_set_text(GTK_LABEL(eb->custom_name[i]), buf);
g_free(buf);
gtk_label_set_text(GTK_LABEL(eb->custom_value[i]), text);
g_free(text);
gtk_widget_show(eb->custom_name[i]);
gtk_widget_show(eb->custom_value[i]);
i++;
}
while (i < EXIF_BAR_CUSTOM_COUNT)
{
gtk_widget_hide(eb->custom_name[i]);
gtk_widget_hide(eb->custom_value[i]);
i++;
}
}
if (eb->advanced_scrolled && GTK_WIDGET_VISIBLE(eb->advanced_scrolled))
{
GtkListStore *store;
GtkTreeIter iter;
GList *work;
store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(eb->listview)));
gtk_list_store_clear(store);
work = exif->items;
while (work)
{
ExifItem *item;
gchar *tag;
const gchar *tag_name;
gchar *text;
const gchar *format;
gchar *elements;
const gchar *description;
item = work->data;
work = work->next;
tag = g_strdup_printf("0x%04x", item->tag);
tag_name = exif_item_get_tag_name(item);
format = exif_item_get_format_name(item, TRUE);
text = exif_item_get_data_as_text(item);
text = bar_exif_validate_text(text);
elements = g_strdup_printf("%d", item->elements);
description = exif_item_get_description(item);
if (!description) description = "";
//.........这里部分代码省略.........
开发者ID:tjwei,项目名称:WebKitGtkKindleDXG,代码行数:101,代码来源:bar_exif.c
示例12: hd_select_plugins_dialog_get_store
static GtkListStore *
hd_select_plugins_dialog_get_store (GList *loaded_plugins,
gchar **plugin_dirs)
{
GKeyFile *keyfile;
const char *filename;
const char *plugin_dir;
GError *error = NULL;
GtkListStore *store;
GtkTreeIter iter;
store = gtk_list_store_new (HD_SPD_N_COLUMNS,
G_TYPE_STRING,
G_TYPE_BOOLEAN,
G_TYPE_STRING);
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
HD_SPD_COLUMN_NAME,
GTK_SORT_ASCENDING);
while ((plugin_dir = *(plugin_dirs++)))
{
GDir *dir;
dir = g_dir_open (plugin_dir, 0, &error);
if (!dir)
{
g_clear_error (&error);
continue;
}
keyfile = g_key_file_new ();
while ((filename = g_dir_read_name (dir)))
{
gchar *desktop_path = NULL;
gchar *name = NULL;
gchar *text_domain = NULL;
GList *active;
error = NULL;
/* Only consider .desktop files */
if (!g_str_has_suffix (filename, ".desktop")) continue;
desktop_path = g_build_filename (plugin_dir, filename, NULL);
g_key_file_load_from_file (keyfile,
desktop_path,
G_KEY_FILE_NONE,
&error);
if (error)
{
g_warning ("Error loading plugin configuration file: %s", error->message);
g_error_free (error);
g_dir_close (dir);
g_key_file_free (keyfile);
g_free (desktop_path);
return NULL;
}
name = g_key_file_get_string (keyfile,
HD_PLUGIN_CONFIG_GROUP,
HD_PLUGIN_CONFIG_KEY_NAME,
&error);
if (error)
{
g_warning ("Error reading plugin configuration file: %s", error->message);
g_error_free (error);
g_dir_close (dir);
g_key_file_free (keyfile);
g_free (desktop_path);
return NULL;
}
active = g_list_find_custom (loaded_plugins,
desktop_path,
hd_select_plugins_dialog_find_func);
gtk_list_store_append (GTK_LIST_STORE (store), &iter);
text_domain = g_key_file_get_string (keyfile,
HD_PLUGIN_CONFIG_GROUP,
HD_PLUGIN_CONFIG_KEY_TEXT_DOMAIN,
NULL);
gtk_list_store_set (GTK_LIST_STORE (store), &iter,
HD_SPD_COLUMN_NAME, (text_domain ? dgettext(text_domain, name) : _(name)),
HD_SPD_COLUMN_ACTIVE, active,
HD_SPD_COLUMN_DESKTOP_FILE, desktop_path,
-1);
//.........这里部分代码省略.........
开发者ID:bruce721,项目名称:next.vifii.com,代码行数:101,代码来源:hd-select-plugins-dialog.c
示例13: mud_connections_populate_iconview
static void
mud_connections_populate_iconview(MudConnections *conn)
{
GSList *muds, *characters, *mud_entry, *char_entry;
gchar *key, *mud_name, *char_name, *display_name,
*name_strip, *char_strip, *buf;
GConfClient *client = gconf_client_get_default();
GtkTreeIter iter;
GdkPixbuf *icon;
key = g_strdup("/apps/gnome-mud/muds");
muds = gconf_client_all_dirs(client, key, NULL);
g_free(key);
for(mud_entry = muds; mud_entry != NULL;
mud_entry = g_slist_next(mud_entry))
{
mud_name = g_path_get_basename((gchar *)mud_entry->data);
name_strip = NULL;
key = g_strdup_printf("/apps/gnome-mud/muds/%s/name", mud_name);
name_strip = gconf_client_get_string(client, key, NULL);
g_free(key);
key = g_strdup_printf("/apps/gnome-mud/muds/%s/characters",
mud_name);
characters = gconf_client_all_dirs(client, key, NULL);
g_free(key);
char_entry = characters;
if(char_entry == NULL) // No Characters
{
key = g_strdup_printf("/apps/gnome-mud/muds/%s/icon", mud_name);
buf = gconf_client_get_string(client, key, NULL);
g_free(key);
if(buf && strcmp(buf, "gnome-mud") != 0)
{
icon = gdk_pixbuf_new_from_file_at_size(
buf, 48, 48, NULL);
g_free(buf);
}
else
icon =
gtk_icon_theme_load_icon(gtk_icon_theme_get_default(),
"gnome-mud", 48, 0, NULL);
gtk_list_store_append(
GTK_LIST_STORE(conn->priv->icon_model), &iter);
gtk_list_store_set(
GTK_LIST_STORE(conn->priv->icon_model), &iter,
MODEL_COLUMN_STRING, name_strip,
MODEL_COLUMN_PIXBUF, icon,
-1);
g_object_unref(icon);
continue;
}
for(char_entry = characters; char_entry != NULL;
char_entry = g_slist_next(char_entry))
{
char_strip = NULL;
char_name = g_path_get_basename((gchar *)char_entry->data);
key = g_strdup_printf(
"/apps/gnome-mud/muds/%s/characters/%s/name",
mud_name, char_name);
char_strip = gconf_client_get_string(client, key, NULL);
g_free(key);
display_name = g_strconcat(char_strip, "\n", name_strip, NULL);
key = g_strdup_printf("/apps/gnome-mud/muds/%s/icon", mud_name);
buf = gconf_client_get_string(client, key, NULL);
g_free(key);
if(buf && strcmp(buf, "gnome-mud") != 0)
{
icon = gdk_pixbuf_new_from_file_at_size(
buf, 48, 48, NULL);
g_free(buf);
}
else
icon =
gtk_icon_theme_load_icon(gtk_icon_theme_get_default(),
"gnome-mud", 48, 0, NULL);
gtk_list_store_append(GTK_LIST_STORE(conn->priv->icon_model),
&iter);
gtk_list_store_set(GTK_LIST_STORE(conn->priv->icon_model),
&iter,
MODEL_COLUMN_STRING, display_name,
MODEL_COLUMN_PIXBUF, icon,
-1);
g_object_unref(icon);
g_free(char_name);
g_free(char_strip);
//.........这里部分代码省略.........
开发者ID:ghoulsblade,项目名称:gnome-mud,代码行数:101,代码来源:mud-connections.c
示例14: obtain_pixbuf_from_stock
/**
* 显示信息/文件接收UI(是否显示信息或文件接收).
*
*/
void DialogPeer::ShowInfoEnclosure(DialogPeer *dlgpr)
{
PalInfo *palinfor;
GtkTreeModel *mdltorcv,*mdlrcvd,*mdltmp;
GSList *ecslist;
GtkWidget *widget,*hpaned,*pbar;
float progress;
GdkPixbuf *pixbuf, *rpixbuf, *dpixbuf;
FileInfo *file;
gchar *filesize,*path;
char progresstip[MAX_BUFLEN];
GtkTreeIter iter;
gint receiving;//标记是不是窗口在正传送文件时被关闭,又打开的。
receiving = 0;
/* 获取文件图标 */
rpixbuf = obtain_pixbuf_from_stock(GTK_STOCK_FILE);
dpixbuf = obtain_pixbuf_from_stock(GTK_STOCK_DIRECTORY);
//设置界面显示
palinfor = (PalInfo *)(dlgpr->grpinf->member->data);
mdltorcv = (GtkTreeModel*)g_datalist_get_data(&(dlgpr->mdlset), "file-to-receive-model");
gtk_list_store_clear(GTK_LIST_STORE(mdltorcv));
mdlrcvd = (GtkTreeModel*)g_datalist_get_data(&(dlgpr->mdlset), "file-received-model");
gtk_list_store_clear(GTK_LIST_STORE(mdlrcvd));
ecslist = cthrd.GetPalEnclosure(palinfor);
if(ecslist) {
//只要有该好友的接收文件信息(不分待接收和未接收),就显示
hpaned = GTK_WIDGET(g_datalist_get_data(&(dlgpr->widset), "main-paned"));
widget = GTK_WIDGET(g_datalist_get_data(&(dlgpr->widset), "info-frame"));
gtk_widget_hide(widget);
widget = GTK_WIDGET(g_datalist_get_data(&(dlgpr->widset),"file-enclosure-frame-widget"));
gtk_paned_pack2(GTK_PANED(hpaned), widget, FALSE, TRUE);
widget = GTK_WIDGET(g_datalist_get_data(&(dlgpr->widset),"file-receive-paned-widget"));
gtk_widget_show(widget);
//将从中心节点取到的数据向附件接收列表填充
dlgpr->torcvsize = 0;
while (ecslist) {
file = (FileInfo *)ecslist->data;
filesize = numeric_to_size(file->filesize);
switch (GET_MODE(file->fileattr)) {
case IPMSG_FILE_REGULAR:
pixbuf = rpixbuf;
break;
case IPMSG_FILE_DIR:
pixbuf = dpixbuf;
break;
default:
pixbuf = NULL;
break;
}
if(file->finishedsize < file->filesize) {
file->filepath = ipmsg_get_filename_me(file->filepath,&path);
if(file->finishedsize > 0)
receiving += 1;
mdltmp = mdltorcv;
dlgpr->torcvsize += file->filesize;
} else
mdltmp = mdlrcvd;
gtk_list_store_append(GTK_LIST_STORE(mdltmp), &iter);
gtk_list_store_set(GTK_LIST_STORE(mdltmp), &iter, 0, pixbuf,
1, file->fileown->name, 2, file->filepath,
3, filesize, 5,file, -1);
g_free(filesize);
ecslist = g_slist_next(ecslist);
}
g_slist_free(ecslist);
//设置进度条,如果接收完成重新载入待接收和已接收列表
if(dlgpr->torcvsize == 0) {
progress = 0;
snprintf(progresstip, MAX_BUFLEN,_("Receiving Progress."));
} else {
if(dlgpr->rcvdsize == 0)
snprintf(progresstip, MAX_BUFLEN,_("%s to Receive."),
numeric_to_size(dlgpr->torcvsize));
else {
progress = percent(dlgpr->rcvdsize,dlgpr->torcvsize)/100;
snprintf(progresstip, MAX_BUFLEN, _("%s Of %s Received."),
numeric_to_size(dlgpr->rcvdsize),numeric_to_size(dlgpr->torcvsize));
}
}
if(progress == 1.0){
g_source_remove(dlgpr->timerrcv);
snprintf(progresstip, MAX_BUFLEN,_("Mission Completed!"));
}
pbar = GTK_WIDGET(g_datalist_get_data(&(dlgpr->widset),
"file-receive-progress-bar-widget"));
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(pbar),progress);
gtk_progress_bar_set_text(GTK_PROGRESS_BAR(pbar),progresstip);
} else {
widget = GTK_WIDGET(g_datalist_get_data(&(dlgpr->widset),
"file-receive-paned-widget"));
gtk_widget_hide(widget);
}
/* 释放文件图标 */
//.........这里部分代码省略.........
开发者ID:Chingpo-Lai,项目名称:iptux,代码行数:101,代码来源:DialogPeer.cpp
示例15: main
int main(int argc, char *argv[]) {
gtk_init(&argc, &argv);
GtkBuilder *builder = gtk_builder_new();
AuthManager *authManager = g_slice_new(AuthManager);
GError *error = NULL;
if (!gtk_builder_add_from_file(builder, "authmanager.glade", &error)) {
g_print(
"Error occurred while loading UI description from file (authmanager.glade)!\n");
g_print("Message: %s\n", error->message);
g_free(error);
g_slice_free(AuthManager, authManager);
return (1);
}
authManager->window = GTK_WIDGET(
gtk_builder_get_object(builder, "mainwindow"));
authManager->key_store = GTK_LIST_STORE(
gtk_builder_get_object(builder, "KeyStore"));
authManager->key_view = GTK_TREE_VIEW(
gtk_builder_get_object(builder, "KeyView"));
authManager->errordialog_nodir = GTK_WIDGET(
gtk_builder_get_object(builder, "errordialog_nodir"));
authManager->enabled_renderer = GTK_CELL_RENDERER(
gtk_builder_get_object(builder, "cellrenderertoggle_enabled"));
authManager->info_renderer = GTK_CELL_RENDERER(
gtk_builder_get_object(builder, "cellrendererpixbuf_info"));
authManager->edit_renderer = GTK_CELL_RENDERER(
gtk_builder_get_object(builder, "cellrendererpixbuf_edit"));
authManager->delete_renderer = GTK_CELL_RENDERER(
gtk_builder_get_object(builder, "cellrendererpixbuf_delete"));
authManager->newdialog.window = GTK_WIDGET(
gtk_builder_get_object(builder, "newdialog_window"));
authManager->newdialog.entry_authname = GTK_ENTRY(
gtk_builder_get_object(builder, "newdialog_entry_authname"));
authManager->newdialog.entry_privkey = GTK_ENTRY(
gtk_builder_get_object(builder, "newdialog_entry_privkey"));
authManager->newdialog.entry_domain = GTK_ENTRY(
gtk_builder_get_object(builder, "newdialog_entry_domain"));
authManager->editdialog.window = GTK_WIDGET(
gtk_builder_get_object(builder, "editdialog_window"));
authManager->editdialog.entry_authname = GTK_ENTRY(
gtk_builder_get_object(builder, "editdialog_entry_authname"));
authManager->editdialog.entry_privkey = GTK_ENTRY(
gtk_builder_get_object(builder, "editdialog_entry_privkey"));
authManager->editdialog.entry_domain = GTK_ENTRY(
gtk_builder_get_object(builder, "editdialog_entry_domain"));
authManager->infodialog.window = GTK_WIDGET(
gtk_builder_get_object(builder, "infodialog_window"));
authManager->infodialog.label_authname = GTK_LABEL(
gtk_builder_get_object(builder, "infodialog_info_authname"));
authManager->infodialog.label_privkey = GTK_LABEL(
gtk_builder_get_object(builder, "infodialog_info_privkey"));
authManager->infodialog.label_pubkey = GTK_LABEL(
gtk_builder_get_o
|
请发表评论