您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GTK_LIST_STORE函数代码示例

51自学网 2021-06-01 20:58:30
  C++
这篇教程C++ GTK_LIST_STORE函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中GTK_LIST_STORE函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_LIST_STORE函数的具体用法?C++ GTK_LIST_STORE怎么用?C++ GTK_LIST_STORE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了GTK_LIST_STORE函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,


示例2: bmd_cell_edited

voidbmd_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,


示例3: repopulate

static voidrepopulate (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,


示例4: refresh_list

static voidrefresh_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,


示例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,


示例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,


示例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,


示例8: tny_gtk_attach_list_model_add

static voidtny_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,


示例9: show_track_properties_dlg

voidshow_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,


示例10: GTK_TREE_VIEW

voidon_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,


示例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,


示例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,


示例13: mud_connections_populate_iconview

static voidmud_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,


示例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,


示例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_object(builder, "infodialog_info_pubkey"));    authManager->infodialog.label_domain = GTK_LABEL(            gtk_builder_get_object(builder, "infodialog_info_domain"));    authManager->infodialog.label_location = GTK_LABEL(            gtk_builder_get_object(builder, "infodialog_info_location"));    gtk_builder_connect_signals(builder, authManager);    g_object_unref(G_OBJECT(builder));    gtk_widget_show(authManager->window);    GTK_CELL_RENDERER_TOGGLE(authManager->enabled_renderer)->activatable = true;    GtkIconTheme *icon_theme = gtk_icon_theme_get_default();    authManager->info_icon_pixbuf = get_stock_icon(icon_theme,            "Icons"FS_DELIM"200px-Gnome-dialog-information.png");    authManager->edit_icon_pixbuf = get_stock_icon(icon_theme,            "Icons"FS_DELIM"200px-Gnome-accessories-text-editor.png");    authManager->delete_icon_pixbuf = get_stock_icon(icon_theme,            "Icons"FS_DELIM"200px-Gnome-edit-delete.png");    if (!authManager->info_icon_pixbuf || !authManager->edit_icon_pixbuf            || !authManager->delete_icon_pixbuf) {        if (authManager->info_icon_pixbuf)            g_object_unref(authManager->info_icon_pixbuf);        if (authManager->edit_icon_pixbuf)            g_object_unref(authManager->edit_icon_pixbuf);        if (authManager->delete_icon_pixbuf)            g_object_unref(authManager->delete_icon_pixbuf);        g_slice_free(AuthManager, authManager);        return (1);    }    if (!load_auth_information(authManager)) {        gtk_dialog_run(GTK_DIALOG(authManager->errordialog_nodir));    } else {        gtk_main();//.........这里部分代码省略.........
开发者ID:MorganBorman,项目名称:cube2AuthManager,代码行数:101,


示例16: gtk_icon_theme_get_default

/** * 显示窗口事件响应函数. *@param dlgpr 对话框类 * */bool DialogPeer::UpdataEnclosureRcvUI(DialogPeer *dlgpr){    GtkTreeModel *model;    GtkWidget *pbar,*button;    float progress;    FileInfo *file;    GtkTreeIter iter;    GtkIconTheme *theme;    GdkPixbuf *pixbuf;    const char *statusfile;    char progresstip[MAX_BUFLEN];    /* 获取文件图标 */    theme = gtk_icon_theme_get_default();    statusfile = "tip-finish";    pixbuf = gtk_icon_theme_load_icon(theme, statusfile, MAX_ICONSIZE,                                             GtkIconLookupFlags(0), NULL);    //处理待接收文件界面显示    model = (GtkTreeModel*)g_datalist_get_data(&(dlgpr->mdlset), "file-to-receive-model");    if(!model) {        g_source_remove(dlgpr->timerrcv);        return FALSE;    }    dlgpr->rcvdsize = 0;    gtk_tree_model_get_iter_first(model, &iter);    do { //遍历待接收model        gtk_tree_model_get(model, &iter,5,&file, -1);        if(pixbuf && (file->finishedsize == file->filesize))             gtk_list_store_set(GTK_LIST_STORE(model), &iter,0,pixbuf,-1);        dlgpr->rcvdsize += file->finishedsize;    } while (gtk_tree_model_iter_next(model, &iter));    //设置进度条,如果接收完成重新载入待接收和已接收列表    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));        }    }    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);    if((progress == 1) || (progress == 0)){        if(progress == 1) {            g_source_remove(dlgpr->timerrcv);            dlgpr->ShowInfoEnclosure(dlgpr);        }        //只要不是在接收过程中,恢复接收和拒收按键        button = GTK_WIDGET(g_datalist_get_data(&(dlgpr->widset), "file-receive-accept-button"));        gtk_widget_set_sensitive(button,TRUE);        button = GTK_WIDGET(g_datalist_get_data(&(dlgpr->widset), "file-receive-refuse-button"));        gtk_widget_set_sensitive(button,TRUE);    } else {        //接收过程中,禁止点接收和拒收按键        button = GTK_WIDGET(g_datalist_get_data(&(dlgpr->widset), "file-receive-accept-button"));        gtk_widget_set_sensitive(button,FALSE);        button = GTK_WIDGET(g_datalist_get_data(&(dlgpr->widset), "file-receive-refuse-button"));        gtk_widget_set_sensitive(button,FALSE);    }    return TRUE;}
开发者ID:Chingpo-Lai,项目名称:iptux,代码行数:74,


示例17: notify_gui_update

voidnotify_gui_update (void){	struct notify *notify;	struct notify_per_server *servnot;	GSList *list = notify_list;	GSList *slist;	gchar *name, *status, *server, *seen;	int online, servcount;	time_t lastseen;	char agobuf[128];	GtkListStore *store;	GtkTreeView *view;	GtkTreeIter iter;	gboolean valid;	/* true if we don't need to append a new tree row */	if (!notify_window)		return;	view = g_object_get_data (G_OBJECT (notify_window), "view");	store = GTK_LIST_STORE (gtk_tree_view_get_model (view));	valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter);	while (list)	{		notify = (struct notify *) list->data;		name = notify->name;		status = _("Offline");		server = "";		online = FALSE;		lastseen = 0;		/* First see if they're online on any servers */		slist = notify->server_list;		while (slist)		{			servnot = (struct notify_per_server *) slist->data;			if (servnot->ison)				online = TRUE;			if (servnot->lastseen > lastseen)				lastseen = servnot->lastseen;			slist = slist->next;		}		if (!online)				  /* Offline on all servers */		{			if (!lastseen)				seen = _("Never");			else			{				snprintf (agobuf, sizeof (agobuf), _("%d minutes ago"), (int)(time (0) - lastseen) / 60);				seen = agobuf;			}			if (!valid)	/* create new tree row if required */				gtk_list_store_append (store, &iter);			gtk_list_store_set (store, &iter, 0, name, 1, status,			                    2, server, 3, seen, 4, &colors[4], 5, NULL, -1);			if (valid)				valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter);		} else		{			/* Online - add one line per server */			servcount = 0;			slist = notify->server_list;			status = _("Online");			while (slist)			{				servnot = (struct notify_per_server *) slist->data;				if (servnot->ison)				{					if (servcount > 0)						name = "";					server = server_get_network (servnot->server, TRUE);					snprintf (agobuf, sizeof (agobuf), _("%d minutes ago"), (int)(time (0) - lastseen) / 60);					seen = agobuf;					if (!valid)	/* create new tree row if required */						gtk_list_store_append (store, &iter);					gtk_list_store_set (store, &iter, 0, name, 1, status,					                    2, server, 3, seen, 4, &colors[3], 5, servnot, -1);					if (valid)						valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter);					servcount++;				}				slist = slist->next;			}		}				list = list->next;	}	while (valid)	{		GtkTreeIter old = iter;		/* get next iter now because removing invalidates old one */		valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (store),//.........这里部分代码省略.........
开发者ID:arinity,项目名称:gchat2,代码行数:101,


示例18: gcm_prefs_setup_space_combobox

//.........这里部分代码省略.........	g_autoptr(GError) error = NULL;	g_autoptr(GPtrArray) devices = NULL;	g_autoptr(GPtrArray) profile_array = NULL;	/* get new list */	profile_array = cd_client_get_profiles_sync (priv->client,						     NULL,						     &error);	if (profile_array == NULL) {		g_warning ("failed to get profiles: %s",			   error->message);		return;	}	/* update each list */	for (i = 0; i < profile_array->len; i++) {		profile = g_ptr_array_index (profile_array, i);		/* connect to the profile */		ret = cd_profile_connect_sync (profile, NULL, &error);		if (!ret) {			g_warning ("failed to connect to profile: %s",				   error->message);			return;		}		/* ignore profiles from other user accounts */		if (!cd_profile_has_access (profile))			continue;		/* is a printer profile */		filename = cd_profile_get_filename (profile);		if (filename == NULL)			continue;		/* only for correct kind */		has_vcgt = cd_profile_get_has_vcgt (profile);		tmp = cd_profile_get_metadata_item (profile, CD_PROFILE_METADATA_STANDARD_SPACE);		colorspace = cd_profile_get_colorspace (profile);		if (!has_vcgt && tmp != NULL &&		    colorspace == CD_COLORSPACE_RGB) {			gcm_prefs_combobox_add_profile (widget, profile, &iter);			/* set active option */			if (g_strcmp0 (tmp, "adobe-rgb") == 0) {				priv->profile_filename = filename;				gtk_combo_box_set_active_iter (GTK_COMBO_BOX (widget), &iter);			}			has_profile = TRUE;		}	}	/* add device profiles */	devices = cd_client_get_devices_by_kind_sync (priv->client,						      CD_DEVICE_KIND_DISPLAY,						      NULL,						      &error);	for (i = 0; i < devices->len; i++) {		device_tmp = g_ptr_array_index (devices, i);		/* connect to the device */		ret = cd_device_connect_sync (device_tmp, NULL, &error);		if (!ret) {			g_warning ("failed to connect to device: %s",				   error->message);			return;		}		profile = cd_device_get_default_profile (device_tmp);		if (profile == NULL)			continue;		/* connect to the profile */		ret = cd_profile_connect_sync (profile, NULL, &error);		if (!ret) {			g_warning ("failed to connect to profile: %s",				   error->message);			return;		}		/* add device profile */		gcm_prefs_combobox_add_profile (widget, profile, NULL);		g_object_unref (profile);		has_profile = TRUE;	}	if (!has_profile) {		/* TRANSLATORS: this is when there are no profiles that can be used;		 * the search term is either "RGB" or "CMYK" */		text = g_strdup_printf (_("No %s color spaces available"),					cd_colorspace_to_localised_string (CD_COLORSPACE_RGB));		model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));		gtk_list_store_append (GTK_LIST_STORE(model), &iter);		gtk_list_store_set (GTK_LIST_STORE(model), &iter,				    GCM_PREFS_COMBO_COLUMN_TEXT, text,				    -1);		gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);		gtk_widget_set_sensitive (widget, FALSE);	}}
开发者ID:GNOME,项目名称:gnome-color-manager,代码行数:101,


示例19: _on_got_events

static void _on_got_events (ZeitgeistResultSet *pEvents, GtkListStore *pModel){	int i, n;	ZeitgeistEvent *event;	ZeitgeistSubject *subject;	gint64 iTimeStamp;	const gchar *cEventURI;	guint id;	gchar *cName = NULL, *cURI = NULL, *cIconName = NULL, *cIconPath, *cPath = NULL;	double fOrder;	int iVolumeID;	gboolean bIsDirectory;	GdkPixbuf *pixbuf;	GtkTreeIter iter;	GHashTable *pHashTable = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, NULL);  // used to prevent doubles		///_____________ parse all the events.	while (zeitgeist_result_set_has_next (pEvents))	{		#ifdef ZEITGEIST_1_0		event = zeitgeist_result_set_next (pEvents);		#else		event = zeitgeist_result_set_next_value (pEvents);		#endif		iTimeStamp = zeitgeist_event_get_timestamp (event) / 1e3;		id = zeitgeist_event_get_id (event);		n = zeitgeist_event_num_subjects (event);		if (n > 1)			cd_debug (" +++ %s, %s, %d", zeitgeist_event_get_interpretation (event), zeitgeist_event_get_manifestation (event), n);		for (i = 0; i < n; i++)		{			subject = zeitgeist_event_get_subject (event, i);						///_____________ prevent doubles.			cEventURI = zeitgeist_subject_get_uri (subject);			if (g_hash_table_lookup_extended  (pHashTable, cEventURI, NULL, NULL))				continue;			//g_print ("  %s:/n    %s, %s/n", cEventURI, zeitgeist_subject_get_interpretation (subject), zeitgeist_subject_get_manifestation (subject));						///_____________ ignore files that have been deleted			cPath = g_filename_from_uri (cEventURI, NULL, NULL);  // NULL for anything else than file://*			if (strncmp (cEventURI, "file://", 7) == 0 && ! g_file_test (cPath, G_FILE_TEST_EXISTS))			{				g_hash_table_insert (pHashTable, (gchar*)cEventURI, NULL);  // since we've checked it, insert it, even if we don't display it.				g_free (cPath);				continue;			}			///_____________ get the text to display.			const gchar *cText = zeitgeist_subject_get_text (subject);			if (cText == NULL)  // skip empty texts (they are most of the times web page that redirect to another page, which is probably in the next event anyway).				continue;						///_____________ find the icon.			if (strncmp (cEventURI, "http", 4) == 0)  // gvfs is deadly slow to get info on distant URI...			{				cIconName = cairo_dock_search_icon_s_path ("text-html", myData.iDesiredIconSize);			}			else if (strncmp (cEventURI, "application://", 14) == 0)  // application URL			{				gchar *cClass = cairo_dock_register_class (cEventURI+14);				cIconName = g_strdup (cairo_dock_get_class_icon (cClass));				cText = cairo_dock_get_class_name (cClass);  // use the translated name				g_free (cClass);			}			else			{				cairo_dock_fm_get_file_info (cEventURI, &cName, &cURI, &cIconName, &bIsDirectory, &iVolumeID, &fOrder, CAIRO_DOCK_FM_SORT_BY_DATE);			}			if (cIconName != NULL)			{				cIconPath = cairo_dock_search_icon_s_path (cIconName, myData.iDesiredIconSize);				pixbuf = gdk_pixbuf_new_from_file_at_size (cIconPath, myData.iDesiredIconSize, myData.iDesiredIconSize, NULL);				g_free (cIconPath);			}			else				pixbuf = NULL;						///_____________ build the path to display.			const gchar *cDisplayedPath = (cPath ? cPath : cEventURI);			// need to escape the '&' (and ', etc.) because gtk-tooltips use markups by default.			gchar *cEscapedPath = g_markup_escape_text (cDisplayedPath, -1);						///_____________ store in the model.			memset (&iter, 0, sizeof (GtkTreeIter));			gtk_list_store_append (GTK_LIST_STORE (pModel), &iter);			gtk_list_store_set (GTK_LIST_STORE (pModel), &iter,				CD_MODEL_NAME, cText,				CD_MODEL_URI, cEventURI,				CD_MODEL_PATH, cEscapedPath,				CD_MODEL_ICON, pixbuf,				CD_MODEL_DATE, iTimeStamp,				CD_MODEL_ID, id, -1);						g_free (cIconName);			cIconName = NULL;			g_free (cName);			cName = NULL;			g_free (cURI);			cURI = NULL;//.........这里部分代码省略.........
开发者ID:Cairo-Dock,项目名称:cairo-dock-plug-ins,代码行数:101,


示例20: ft_manager_add_handler_to_list

static voidft_manager_add_handler_to_list (EmpathyFTManager *manager,                                EmpathyFTHandler *handler,                                const GError *error){  GtkTreeRowReference *row_ref;  GtkTreeIter iter;  GtkTreeSelection *selection;  GtkTreePath *path;  GIcon *icon;  const char *content_type, *second_line;  char *first_line, *message;  EmpathyFTManagerPriv *priv = GET_PRIV (manager);  icon = NULL;  /* get the icon name from the mime-type of the file. */  content_type = empathy_ft_handler_get_content_type (handler);  if (content_type != NULL)    icon = g_content_type_get_icon (content_type);  /* append the handler in the store */  gtk_list_store_insert_with_values (GTK_LIST_STORE (priv->model),      &iter, G_MAXINT, COL_FT_OBJECT, handler,      COL_ICON, icon, -1);  if (icon != NULL)    g_object_unref (icon);  /* insert the new row_ref in the hash table  */  path = gtk_tree_model_get_path (GTK_TREE_MODEL (priv->model), &iter);  row_ref = gtk_tree_row_reference_new (GTK_TREE_MODEL (priv->model), path);  gtk_tree_path_free (path);  g_hash_table_insert (priv->ft_handler_to_row_ref, g_object_ref (handler),      row_ref);  /* select the new row */  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->treeview));  gtk_tree_selection_select_iter (selection, &iter);  if (error != NULL)    {      message = ft_manager_format_error_message (handler, error);      ft_manager_update_handler_message (manager, row_ref, message);      g_free (message);      return;    }  /* update the row with the initial values.   * the only case where we postpone this is in case we're managing   * an outgoing+hashing transfer, as the hashing started signal will   * take care of updating the information.   */  if (empathy_ft_handler_is_incoming (handler) ||      !empathy_ft_handler_get_use_hash (handler)) {    first_line = ft_manager_format_contact_info (handler);    second_line = _("Waiting for the other participant's response");    message = g_strdup_printf ("%s/n%s", first_line, second_line);    ft_manager_update_handler_message (manager, row_ref, message);    g_free (first_line);    g_free (message);  }  /* hook up the signals and start the transfer */  ft_manager_start_transfer (manager, handler);}
开发者ID:Evnsan,项目名称:empathy,代码行数:70,


示例21: lookuptable_changed

//G_MODULE_EXPORT gboolean lookuptable_changed(GtkCellRendererCombo *renderer, gchar *path, gchar * new_text, gpointer data)G_MODULE_EXPORT gboolean lookuptable_changed(GtkCellRendererCombo *renderer, gchar *path, GtkTreeIter *new_iter, gpointer data){	GtkTreeModel *combostore = NULL;	GtkTreeIter iter;	GtkTreeModel *model = (GtkTreeModel *)data;	ConfigFile *cfgfile = NULL;	gchar * new_text = NULL;	gchar * int_name = NULL;	gchar * old = NULL;	gchar * new_name = NULL;	gchar ** vector = NULL;	const gchar * project = NULL;	gboolean restart_tickler = FALSE;	GAsyncQueue *io_data_queue = NULL;	Firmware_Details *firmware = NULL;	ENTER();	firmware = (Firmware_Details *)DATA_GET(global_data,"firmware");	io_data_queue = (GAsyncQueue *)DATA_GET(global_data,"io_data_queue");	/* Get combo box model so we can set the combo to this new value */	g_object_get(G_OBJECT(renderer),"model",&combostore,NULL);	gtk_tree_model_get(combostore,new_iter,0,&new_text,-1);	/* Get combo box model so we can set the combo to this new value */	gtk_tree_model_get_iter_from_string(model,&iter,path);	gtk_tree_model_get(model,&iter,INTERNAL_NAME_COL,&int_name,FILENAME_COL,&old,-1);	//printf("New text is %s, int name associated %s, filename %s/n",new_text,int_name,old);	if (g_ascii_strcasecmp(old,new_text) == 0) /* If no change, return */	{		g_free(int_name);		g_free(old);		EXIT();		return TRUE;	}	if (g_ascii_strcasecmp(new_text,"Personal") == 0)	{		g_free(int_name);		g_free(old);		EXIT();		return TRUE;	}	if (g_ascii_strcasecmp(new_text,"System") == 0)	{		g_free(int_name);		g_free(old);		EXIT();		return TRUE;	}	if (DATA_GET(global_data,"realtime_id"))	{		gint count = 0;		restart_tickler = TRUE;		stop_tickler(RTV_TICKLER);		while ((g_async_queue_length(io_data_queue) > 0) && (count < 30))		{			MTXDBG(CRITICAL,_("Draining I/O Queue, current length %i/n"),g_async_queue_length(io_data_queue));			count++;		}	}	get_table(int_name,new_text,NULL); /* Load the new one in it's place */	gtk_list_store_set(GTK_LIST_STORE(model),&iter, FILENAME_COL, new_text,-1);	if (restart_tickler)		start_tickler(RTV_TICKLER);	cfgfile = cfg_open_file(firmware->profile_filename);	if (!cfgfile)	{		g_free(int_name);		g_free(old);		EXIT();		return FALSE;	}	g_hash_table_foreach((GHashTable *)DATA_GET(global_data,"lookuptables"),update_lt_config,cfgfile);	if (g_strrstr(firmware->profile_filename,"mtx"))		cfg_write_file(cfgfile, firmware->profile_filename);	else	{		project = (const gchar *)DATA_GET(global_data,"project_name");		vector = g_strsplit(firmware->profile_filename,PSEP,-1);		if (!project)			project = DEFAULT_PROJECT;		new_name = g_build_filename(HOME(),"mtx",project,INTERROGATOR_DATA_DIR,"Profiles",vector[g_strv_length(vector)-2],vector[g_strv_length(vector)-1],NULL);		g_strfreev(vector);		cfg_write_file(cfgfile, new_name);		g_free(firmware->profile_filename);		firmware->profile_filename=g_strdup(new_name);		g_free(new_name);	}	cfg_free(cfgfile);	/*printf("internal name %s, old table %s, new table %s/n",int_name,old,new_text);*/	g_free(int_name);	g_free(old);	EXIT();	return TRUE;}
开发者ID:JacobD10,项目名称:MegaTunix,代码行数:100,


示例22: xfpm_info_update_wakeups

/** *  * Method GetData on /org/freedesktop/DeviceKit/Power/Wakeups *  * <method name="GetData"> *     <arg name="data" type="a(budss)" direction="out"/> (1) * </method> *  (1): array | boolean	Wheter the proceess on userspace * 	       | uint           PID *             | double		Wakeups value             *             | string         command line *             | string         details **/static voidxfpm_info_update_wakeups (XfpmInfo *info){    GtkListStore *store;        GError *error = NULL;        static GType collection_type = G_TYPE_INVALID;    static GType struct_type = G_TYPE_INVALID;    GPtrArray *array = NULL;        gboolean ret;    guint i;        if ( G_UNLIKELY (collection_type == G_TYPE_INVALID ) )    {	struct_type = dbus_g_type_get_struct ("GValueArray",					      G_TYPE_BOOLEAN,					      G_TYPE_UINT,					      G_TYPE_DOUBLE,					      G_TYPE_STRING,					      G_TYPE_STRING,					      G_TYPE_INVALID);    	collection_type = dbus_g_type_get_collection ("GPtrArray", struct_type);    }        ret = dbus_g_proxy_call (info->wakeups_proxy, "GetData", &error,			     G_TYPE_INVALID,			     collection_type, &array,			     NULL);		           if ( !ret )    {	g_warning ("GetData Failed on %s : %s", UPOWER_PATH_WAKEUPS, error->message);	g_error_free (error);	return;    }		        store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (info->wakeups)));        gtk_list_store_clear (GTK_LIST_STORE (store));        for ( i = 0; i < array->len; i++ )    {	GValue elem = { 0 };	GtkTreeIter iter;		gboolean userspace;	guint pid;	gdouble value;	gchar *cmd;	gchar *formatted_cmd;	gchar *details;	gchar *formatted_details;	gchar *pid_str;	gchar *value_str;	const gchar *icon;		g_value_init (&elem, struct_type);	g_value_set_static_boxed (&elem, g_ptr_array_index (array, i));		dbus_g_type_struct_get (&elem,				0, &userspace,				1, &pid,				2, &value,				3, &cmd,				4, &details,				G_MAXUINT);		if ( userspace )	{	    pid_str = g_strdup_printf ("%i", pid);	}	else	{	    if ( pid < 0xff0 )	    {		pid_str = g_strdup_printf ("IRQ%i", pid);	    }	    else	    {		pid_str = g_strdup("IRQx");	    }	}	value_str = g_strdup_printf ("%.1f", value);//.........这里部分代码省略.........
开发者ID:b1-systems,项目名称:for-upstream-xfce4-power-manager,代码行数:101,


示例23: window_tab_added

static voidwindow_tab_added (PlumaWindow         *window,		  PlumaTab            *tab,		  PlumaDocumentsPanel *panel){	GtkTreeIter iter;	GtkTreeIter sibling;	GdkPixbuf *pixbuf;	gchar *name;	g_signal_connect (tab,			 "notify::name",			  G_CALLBACK (sync_name_and_icon),			  panel);	g_signal_connect (tab,			 "notify::state",			  G_CALLBACK (sync_name_and_icon),			  panel);	get_iter_from_tab (panel, tab, &sibling);	panel->priv->adding_tab = TRUE;		if (gtk_list_store_iter_is_valid (GTK_LIST_STORE (panel->priv->model), 					  &sibling))	{		gtk_list_store_insert_after (GTK_LIST_STORE (panel->priv->model),					     &iter,					     &sibling);	}	else	{		PlumaTab *active_tab;		gtk_list_store_append (GTK_LIST_STORE (panel->priv->model), 				       &iter);		active_tab = pluma_window_get_active_tab (panel->priv->window);		if (tab == active_tab)		{			GtkTreeSelection *selection;			selection = gtk_tree_view_get_selection (						GTK_TREE_VIEW (panel->priv->treeview));			gtk_tree_selection_select_iter (selection, &iter);		}	}	name = tab_get_name (tab);	pixbuf = _pluma_tab_get_icon (tab);	gtk_list_store_set (GTK_LIST_STORE (panel->priv->model),			    &iter,		            PIXBUF_COLUMN, pixbuf,		            NAME_COLUMN, name,		            TAB_COLUMN, tab,		            -1);	g_free (name);	if (pixbuf != NULL)		g_object_unref (pixbuf);	panel->priv->adding_tab = FALSE;}
开发者ID:fatman2021,项目名称:pluma,代码行数:67,


示例24: config_start

static voidconfig_start(GcomprisBoard *agcomprisBoard,	     GcomprisProfile *aProfile){  board_conf = agcomprisBoard;  profile_conf = aProfile;  if (gcomprisBoard)    pause_board(TRUE);  gc_locale_set( NULL );  gchar *label = g_strdup_printf(_("<b>%1$s</b> configuration/n for profile <b>%2$s</b>"),				 agcomprisBoard->name,				 aProfile ? aProfile->name : "");  GcomprisBoardConf *bconf;  bconf = gc_board_config_window_display(label, conf_ok);  g_free(label);  /* init the combo to previously saved value */  GHashTable *config = gc_db_get_conf( profile_conf, board_conf);  gchar *saved_locale_sound = g_hash_table_lookup( config, "locale_sound");  gc_board_config_combo_locales_asset(bconf, "Select sound locale", saved_locale_sound,				      "voices/$LOCALE/colors/purple.ogg",				      G_CALLBACK (locale_changed));  /* frame */  GtkWidget *frame = gtk_frame_new("");  gtk_widget_show(frame);  gtk_box_pack_start(GTK_BOX(bconf->main_conf_box),		     frame, TRUE, TRUE, 8);  GtkWidget *vbox = gtk_vbox_new(FALSE, 8);  gtk_widget_show(vbox);  gtk_container_add(GTK_CONTAINER(frame), vbox);  /* list view */  GtkListStore *list = gtk_list_store_new(N_COLUMNS,					  G_TYPE_UINT,    /* Level */					  G_TYPE_STRING,  /* Answers */					  G_TYPE_STRING   /* Questions */					  );  GtkWidget *treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(list));  configure_colummns(GTK_TREE_VIEW(treeview));  gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (treeview), TRUE);  gtk_tree_view_set_search_column (GTK_TREE_VIEW (treeview), LEVEL_COLUMN);  gtk_widget_set_size_request(treeview, -1, 200);  gtk_widget_show(treeview);  GtkScrolledWindow *scroll = GTK_SCROLLED_WINDOW(gtk_scrolled_window_new(NULL,NULL));  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),				  GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);  gtk_widget_show(GTK_WIDGET(scroll));  gtk_container_add(GTK_CONTAINER(scroll), treeview);  gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(scroll), TRUE, TRUE, 10);  GtkTreeSelection *selection;  selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));  gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);  model = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(treeview)));  load_model_from_levels(model);  /* some buttons */  GtkWidget *hbox = gtk_hbox_new (TRUE, 4);  gtk_widget_show(hbox);  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);  GtkWidget *button = gtk_button_new_from_stock(GTK_STOCK_NEW);  gtk_widget_show(button);  g_signal_connect (button, "clicked",		    G_CALLBACK (add_item), model);  gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);  button = gtk_button_new_from_stock(GTK_STOCK_DELETE);  gtk_widget_show(button);  g_signal_connect (button, "clicked",		    G_CALLBACK (remove_item), treeview);  gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);  button = gtk_button_new_from_stock(GTK_STOCK_GO_UP);  gtk_widget_show(button);  g_signal_connect (button, "clicked",		    G_CALLBACK (up_item), treeview);  gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);  button = gtk_button_new_from_stock(GTK_STOCK_GO_DOWN);  gtk_widget_show(button);  g_signal_connect (button, "clicked",		    G_CALLBACK (down_item), treeview);  gtk_box_pack_start (GTK_BOX (hbox), button, TRUE, TRUE, 0);  hbox = gtk_hbox_new (TRUE, 4);  gtk_widget_show(hbox);//.........这里部分代码省略.........
开发者ID:MkPereira,项目名称:gcompris,代码行数:101,


示例25: toggled_callback

static voidtoggled_callback (GtkCellRendererToggle *celltoggle,                  gchar                 *path_string,                  GtkTreeView           *tree_view){  GtkTreeModel *model = NULL;  GtkTreeModelSort *sort_model = NULL;  GtkTreePath *path;  GtkTreeIter iter;  gboolean active = FALSE;    g_return_if_fail (GTK_IS_TREE_VIEW (tree_view));  model = gtk_tree_view_get_model (tree_view);    if (GTK_IS_TREE_MODEL_SORT (model))    {      sort_model = GTK_TREE_MODEL_SORT (model);      model = gtk_tree_model_sort_get_model (sort_model);    }  if (model == NULL)    return;  if (sort_model)    {      g_warning ("FIXME implement conversion from TreeModelSort iter to child model iter");      return;    }        path = gtk_tree_path_new_from_string (path_string);  if (!gtk_tree_model_get_iter (model,                                &iter, path))    {      g_warning ("%s: bad path?", G_STRLOC);      return;    }  gtk_tree_path_free (path);    if (GTK_IS_LIST_STORE (model))    {      gtk_tree_model_get (GTK_TREE_MODEL (model),                          &iter,                          BOOL_COLUMN,                          &active,                          -1);            gtk_list_store_set (GTK_LIST_STORE (model),                          &iter,                          BOOL_COLUMN,                          !active,                          -1);    }  else if (GTK_IS_TREE_STORE (model))    {      gtk_tree_model_get (GTK_TREE_MODEL (model),                          &iter,                          BOOL_COLUMN,                          &active,                          -1);                  gtk_tree_store_set (GTK_TREE_STORE (model),                          &iter,                          BOOL_COLUMN,                          !active,                          -1);    }  else    g_warning ("don't know how to actually toggle value for model type %s",               g_type_name (G_TYPE_FROM_INSTANCE (model)));}
开发者ID:sam-m888,项目名称:gtk,代码行数:71,


示例26: hybrid_info_notify

voidhybrid_info_notify(HybridAccount *account, HybridNotifyInfo *info,        const gchar *buddy_id){    GtkTreeIter iter;    GtkTreeModel *model;    HybridBuddy *buddy;    HybridInfo *info_panel;    HybridInfoItem *item;    GSList *info_pos;    GSList *pos;    gchar *name_markup;    gchar *name_escaped;    gchar *value_escaped;    g_return_if_fail(info != NULL);    for (info_pos = info_list; info_pos; info_pos = info_pos->next) {        info_panel = (HybridInfo*)info_pos->data;        if (g_strcmp0(info_panel->buddy->id, buddy_id) == 0) {            goto buddy_ok;        }    }    if (!(buddy = hybrid_blist_find_buddy(account, buddy_id))) {        hybrid_debug_error("info", "can not find buddy with id :/'%s/'",                buddy_id);        return;    }    info_panel = hybrid_info_create(buddy);buddy_ok:    model = gtk_tree_view_get_model(GTK_TREE_VIEW(info_panel->treeview));    for (pos = info->item_list; pos; pos = pos->next) {        item = (HybridInfoItem*)pos->data;        name_escaped = g_markup_escape_text(item->name, -1);        if (item->value) {            value_escaped = g_markup_escape_text(item->value, -1);        } else {            value_escaped = NULL;        }        name_markup = g_strdup_printf("<b>%s:</b>", name_escaped);        gtk_list_store_append(GTK_LIST_STORE(model), &iter);        gtk_list_store_set(GTK_LIST_STORE(model), &iter,                HYBRID_INFO_NAME_COLUMN, name_markup,                HYBRID_INFO_VALUE_COLUMN, value_escaped,                HYBRID_INFO_PIXBUF_COLUMN, item->pixbuf,                HYBRID_INFO_VALUE_COLUMN_VISIBLE,                item->type == HYBRID_INFO_ITEM_TYPE_TEXT ? TRUE : FALSE,                HYBRID_INFO_PIXBUF_COLUMN_VISIBLE,                item->type == HYBRID_INFO_ITEM_TYPE_PIXBUF ? TRUE : FALSE,                -1);        g_free(name_markup);        g_free(name_escaped);        g_free(value_escaped);    }}
开发者ID:GCrean,项目名称:hybrid,代码行数:73,


示例27: pull_dialog

static voidpull_dialog (Git *plugin){	GtkBuilder *bxml;	gchar *objects[] = {"pull_dialog", "remote_list_model", NULL};	GError *error;	GtkWidget *dialog;	GtkWidget *pull_repository_vbox;	GtkWidget *pull_remote_toggle;	GtkWidget *pull_url_toggle;	GtkWidget *pull_repository_notebook;	GtkWidget *pull_origin_check;	GtkListStore *remote_list_model;	GitUIData *data;	GitRemoteListCommand *remote_list_command;		bxml = gtk_builder_new ();	error = NULL;	if (!gtk_builder_add_objects_from_file (bxml, BUILDER_FILE, objects, 	                                        &error))	{		g_warning ("Couldn't load builder file: %s", error->message);		g_error_free (error);	}		dialog = GTK_WIDGET (gtk_builder_get_object (bxml, "pull_dialog"));	pull_repository_vbox = GTK_WIDGET (gtk_builder_get_object (bxml,	                                                           "pull_repository_vbox"));	pull_remote_toggle = GTK_WIDGET (gtk_builder_get_object (bxml,	                                                         "pull_remote_toggle"));	pull_url_toggle = GTK_WIDGET (gtk_builder_get_object (bxml,	                                                      "pull_url_toggle"));	pull_repository_notebook = GTK_WIDGET (gtk_builder_get_object (bxml,	                                                               "pull_repository_notebook"));	pull_origin_check = GTK_WIDGET (gtk_builder_get_object (bxml, 	                                                        "pull_origin_check"));	remote_list_model = GTK_LIST_STORE (gtk_builder_get_object (bxml,	                                                            "remote_list_model"));	data = git_ui_data_new (plugin, bxml);	remote_list_command = git_remote_list_command_new (plugin->project_root_directory);	g_object_set_data (G_OBJECT (remote_list_command), "origin-check", 	                   pull_origin_check);	g_signal_connect (G_OBJECT (remote_list_command), "data-arrived",	                  G_CALLBACK (on_git_remote_list_command_data_arrived),	                  remote_list_model);	g_signal_connect (G_OBJECT (remote_list_command), "command-finished",	                  G_CALLBACK (on_remote_list_command_finished),	                  data);	anjuta_command_start (ANJUTA_COMMAND (remote_list_command));		g_signal_connect (G_OBJECT (dialog), "response", 					  G_CALLBACK (on_pull_dialog_response), 					  data);	g_object_set_data (G_OBJECT (pull_remote_toggle), "tab-index",	                   GINT_TO_POINTER (0));	g_object_set_data (G_OBJECT (pull_url_toggle), "tab-index",	                   GINT_TO_POINTER (1));	g_signal_connect (G_OBJECT (pull_remote_toggle), "toggled",	                  G_CALLBACK (on_git_notebook_button_toggled),	                  pull_repository_notebook);	g_signal_connect (G_OBJECT (pull_url_toggle), "toggled",	                  G_CALLBACK (on_git_notebook_button_toggled),	                  pull_repository_notebook);	g_signal_connect (G_OBJECT (pull_origin_check), "toggled",	                  G_CALLBACK (on_git_origin_check_toggled),	                  pull_repository_vbox);		gtk_widget_show_all (dialog);}
开发者ID:abderrahim,项目名称:anjuta,代码行数:79,



注:本文中的GTK_LIST_STORE函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ GTK_MENU函数代码示例
C++ GTK_LIST_BOX函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。