⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uicompcntlistview.c

📁 linux手机上的phonebook代码
💻 C
字号:
/*	contact - LiPS Address Book Application * *	Authors: YE Nan <nan.ye@orange-ftgroup.com>  *	 *	This software and associated documentation files (the "Software")  *	are copyright (C) 2005 LiPS Linux Phone Standards Forum [FranceTelecom]  *	All Rights Reserved.  * *	A copyright license is hereby granted for redistribution and use of  *	the Software in source and binary forms, with or without modification,  *	provided that the following conditions are met:  *	- Redistributions of source code must retain the above copyright notice,  *	this copyright license and the following disclaimer.  *  - Redistributions in binary form must reproduce the above copyright  * 	notice, this copyright license and the following disclaimer in the  *	documentation and/or other materials provided with the distribution.  *	- Neither the name of LiPS  nor the names of its Members may be used  *	to endorse or promote products derived from the Software without  *	specific prior written permission.  * *	A patent license for any Necessary Claims owned by Members of LiPS Forum  *	to make, have made, use, import, offer to sell, lease and sell or otherwise  *	distribute any implementation compliant with the any specification adopted  *	by the LiPS Forumcan be obtained from the respective Members on reasonable  *	and non-discriminatory terms and conditions and under reciprocity, as  *	regulated in more detail in the Internal Policy of the LiPS Forum.  * *	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER, ITS MEMBERS AND CONTRIBUTORS  *	"AS IS", AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,  *	THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE  *	AND NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER,  *	ITS MEMBERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,  *	SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,  *	PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;  *	OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,  *	WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)  *	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE  *	POSSIBILITY OF SUCH DAMAGE.  */#include <stdio.h>#include <glib.h>#include <gtk/gtk.h>#include <gem.h>#include <uicompcntlistview.h>static void ui_comp_cnt_list_view_class_init		(UICompCntListViewClass	*klass);static void ui_comp_cnt_list_view_init					(UICompCntListView			*cntview);static void	ui_comp_cnt_list_view_destroy				(GtkObject							*object);static GemTreeViewClass * parent_class = NULL;GTypeui_comp_cnt_list_view_get_type (void){	static GType cnt_list_view_type = 0;  if (!cnt_list_view_type)	{		static const GTypeInfo cnt_list_view_info =		{			sizeof (UICompCntListViewClass),			NULL,		/* base_init */			NULL,		/* base_finalize */			(GClassInitFunc) ui_comp_cnt_list_view_class_init,			NULL,		/* class_finalize */			NULL,		/* class_data */			sizeof (UICompCntListView),			0,			/* n_preallocs */			(GInstanceInitFunc) ui_comp_cnt_list_view_init,			NULL,		};		cnt_list_view_type = g_type_register_static(GEM_TYPE_TREE_VIEW,																								"UICompCntListView",																								&cnt_list_view_info,																								0);	}	return cnt_list_view_type;}static voidui_comp_cnt_list_view_class_init (UICompCntListViewClass * klass){  GtkObjectClass *object_class;  object_class = (GtkObjectClass*)klass;  parent_class = g_type_class_peek_parent(klass);  object_class->destroy = ui_comp_cnt_list_view_destroy;	return;}static voidui_comp_cnt_list_view_destroy (GtkObject *object){	UICompCntListView * cnt_list_view = UI_COMP_CNT_LIST_VIEW(object);  (*GTK_OBJECT_CLASS(parent_class)->destroy)(object);    return;}static voidui_comp_cnt_list_view_init (UICompCntListView * cntview){	GtkWidget *treeview = NULL;	GtkTreeViewColumn	*col = NULL;	GtkCellRenderer *renderer = NULL;	GtkListStore * liststore = NULL;		g_print("%s(): invoke the gem_tree_get_view()\n",__FUNCTION__);	treeview = gem_tree_view_get_view(GEM_TREE_VIEW(cntview));	/* column name */	col = gtk_tree_view_column_new();	gtk_tree_view_column_set_title(col, "Name");	gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), col);		renderer = gtk_cell_renderer_text_new();	gtk_cell_renderer_set_fixed_size(renderer,																	 130,																	 -1);/*	g_object_set(G_OBJECT(renderer),							 "xalign",							 1.0,							 NULL);	g_object_set(G_OBJECT(renderer),							 "ypad",							 5,							 NULL);*/		gtk_tree_view_column_pack_start(col,																	renderer,																	TRUE);	gtk_tree_view_column_set_alignment(col,																		 1);	gtk_tree_view_column_add_attribute(col,																		 renderer,																		 "text",																		 UI_COMP_CNT_LV_NAME);	/* column pic */	col = gtk_tree_view_column_new();	gtk_tree_view_column_set_title(col, "Picutre");	gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), col);		renderer = gtk_cell_renderer_pixbuf_new();	gtk_cell_renderer_set_fixed_size(renderer,																	 32,																	 32);	gtk_tree_view_column_pack_start(col,																	renderer,																	TRUE);	gtk_tree_view_column_add_attribute(col,																		 renderer,																		 "pixbuf",																		 UI_COMP_CNT_LV_PIC);		liststore = gtk_list_store_new(NUM_UI_COMP_CNT_LV_COLS,																 G_TYPE_UINT,																 G_TYPE_UINT,																 G_TYPE_STRING,																 GDK_TYPE_PIXBUF,																 G_TYPE_INT);		gem_tree_view_set_model(GEM_TREE_VIEW(cntview),													GTK_TREE_MODEL(liststore));													 	g_object_unref(liststore);	return;}GtkWidget *ui_comp_cnt_list_view_new (void){	return gtk_widget_new(UI_COMP_TYPE_CNT_LIST_VIEW,												NULL);}voidui_comp_cnt_list_view_update (UICompCntListView	*cntview){	GtkTreePath *path = NULL;	GtkTreeView *treeview = NULL;    treeview = GTK_TREE_VIEW(gem_tree_view_get_view(GEM_TREE_VIEW(cntview)));  	path = gtk_tree_path_new_first();	gtk_tree_view_set_cursor(treeview,													 path,													 NULL,													 TRUE);  gtk_tree_path_free(path);	return;}/*vi:ts=2:nowrap:ai:expandtab */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -