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

📄 uicompcnteditview.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.  *//********************      wrote by qzh 2007-01-22  ************************/#include <stdio.h>#include <glib.h>#include <gtk/gtk.h>#include <gem.h>#include <uicompcnteditview.h>#include <gemhashview.h>#include "gemhashviewcell.h"#include "gemhashviewcellstd.h"#include "gemhashviewcellimg.h"static void ui_comp_cnt_edit_view_class_init		(UICompCntEditViewClass	*klass);static void ui_comp_cnt_edit_view_init					(UICompCntEditView			*cntview);static void	ui_comp_cnt_edit_view_destroy				(GtkObject							*object);static GemHashViewClass	*parent_class = NULL;GTypeui_comp_cnt_edit_view_get_type(void){	static GType cnt_edit_view_type = 0;		g_print("%s(): cnt_edit_view_type: %d \n", __FUNCTION__, cnt_edit_view_type);  if (!cnt_edit_view_type)	{		static const GTypeInfo cnt_edit_view_info =		{			sizeof (UICompCntEditViewClass),			NULL,		/* base_init */			NULL,		/* base_finalize */			(GClassInitFunc) ui_comp_cnt_edit_view_class_init,			NULL,		/* class_finalize */			NULL,		/* class_data */			sizeof (UICompCntEditView),			0,			/* n_preallocs */			(GInstanceInitFunc) ui_comp_cnt_edit_view_init,			NULL,		};		cnt_edit_view_type = g_type_register_static(GEM_TYPE_HASH_VIEW,																								"UICompCntEditView",																								&cnt_edit_view_info,																								0);	}	return cnt_edit_view_type;}static voidui_comp_cnt_edit_view_class_init (UICompCntEditViewClass *klass){  GtkObjectClass *object_class;  object_class = (GtkObjectClass*)klass;  parent_class = g_type_class_peek_parent(klass);  object_class->destroy = ui_comp_cnt_edit_view_destroy;	return;}static voidui_comp_cnt_edit_view_destroy (GtkObject *object){	UICompCntEditView *cnt_edit_view = UI_COMP_CNT_EDIT_VIEW(object);  (*GTK_OBJECT_CLASS(parent_class)->destroy)(object);    return;}static voidui_comp_cnt_edit_view_init (UICompCntEditView *cntview){	g_print("\n%s() : entering\n",__FUNCTION__);	GemHashView *base = GEM_HASH_VIEW(cntview);	GtkWidget *seperator = NULL;	GtkWidget *cell = NULL;	GtkWidget *image = NULL;		gchar *picpath = NULL;	GtkWidget *hbox = NULL;			/* Name Cell */	cell = gem_hash_view_cell_std_new("<span color=\"Blue\">Name</span>");	 	gem_hash_view_set_item (GEM_HASH_VIEW(cntview),												  AB_IV_LAST_NAME,												  GEM_HASH_VIEW_CELL(cell));												 	gtk_widget_set_size_request (gem_hash_view_cell_std_get_entry                               (GEM_HASH_VIEW_CELL_STD(cell)), 100, -1);	/* Image */  image = gtk_image_new ();  if (TRUE)  {  	    GdkPixbuf *pixbuf = NULL;    picpath =      g_build_filename (gem_env_get_resource_path(), "/pixmaps/icon00.png", NULL);    gem_resource_load_pic (picpath, GEM_PIC_LARGE);    pixbuf = gem_resource_find_pic (picpath, GEM_PIC_LARGE);    gtk_image_set_from_pixbuf (image, pixbuf);    g_free (picpath);        hbox = gtk_hbox_new (FALSE, 0);    gtk_widget_set_size_request (hbox, -1, 70);    gtk_box_pack_start (GTK_BOX (hbox), cell, FALSE, FALSE, 10);    gtk_box_pack_end (GTK_BOX (hbox), image,  FALSE, FALSE, 10);    gtk_box_pack_start (GTK_BOX (base->layout), hbox,  FALSE, FALSE, 10);  }  /* Seperator */  seperator = gtk_hseparator_new ();  gtk_box_pack_start (GTK_BOX (base->layout), seperator, FALSE, FALSE, 0);      /* Mobile Number Cell */  cell = gem_hash_view_cell_std_new ("<span color=\"Blue\">Mobile Number</span>");  gem_hash_view_set_item (GEM_HASH_VIEW(cntview),                          AB_IV_MOBILE_NUM,                          GEM_HASH_VIEW_CELL (cell));	                                  	gtk_widget_set_size_request (gem_hash_view_cell_std_get_entry                              (GEM_HASH_VIEW_CELL_STD(cell)), 215, -1);		hbox = gtk_hbox_new (FALSE, 0);  gtk_widget_set_size_request (hbox, -1, -1);  gtk_box_pack_start (GTK_BOX (hbox), cell, FALSE, FALSE, 0);  gtk_box_pack_start (GTK_BOX (base->layout), cell,  FALSE, FALSE, 0);             /* Home Number */  cell = gem_hash_view_cell_std_new("<span color=\"Blue\">Home Number</span>");  gem_hash_view_set_item(GEM_HASH_VIEW(cntview),  											 AB_IV_HOME_NUM,  											 GEM_HASH_VIEW_CELL(cell)); 	gtk_widget_set_size_request (gem_hash_view_cell_std_get_entry                              (GEM_HASH_VIEW_CELL_STD(cell)), 215, -1);  											  											 	hbox = gtk_hbox_new (FALSE, 0);  gtk_widget_set_size_request (hbox, -1, -1);  gtk_box_pack_start (GTK_BOX (hbox), cell, FALSE, FALSE, 0);  gtk_box_pack_start (GTK_BOX (base->layout), hbox,  FALSE, FALSE, 0);   						/* Business Number */  cell = gem_hash_view_cell_std_new("<span color=\"Blue\">Business Number</span>");  gem_hash_view_set_item(GEM_HASH_VIEW(cntview),  											 AB_IV_BUSI_NUM,  											 GEM_HASH_VIEW_CELL(cell)); 	gtk_widget_set_size_request (gem_hash_view_cell_std_get_entry                               (GEM_HASH_VIEW_CELL_STD(cell)), 215, -1);	hbox = gtk_hbox_new (FALSE, 0);  gtk_widget_set_size_request (hbox, -1, -1);  gtk_box_pack_start (GTK_BOX (hbox), cell, FALSE, FALSE, 0);  gtk_box_pack_start (GTK_BOX (base->layout), hbox,  FALSE, FALSE, 0);  					/* FAX Number */  cell = gem_hash_view_cell_std_new("<span color=\"Blue\">Fax Number</span>");  gem_hash_view_set_item(GEM_HASH_VIEW(cntview),  											 AB_IV_FAXNUM,  											 GEM_HASH_VIEW_CELL(cell));	gtk_widget_set_size_request (gem_hash_view_cell_std_get_entry                               (GEM_HASH_VIEW_CELL_STD(cell)), 215, -1);	hbox = gtk_hbox_new (FALSE, 0);  gtk_widget_set_size_request (hbox, -1, -1);  gtk_box_pack_start (GTK_BOX (hbox), cell, FALSE, FALSE, 0);  gtk_box_pack_start (GTK_BOX (base->layout), hbox,  FALSE, FALSE, 0);  					/* Company */  cell = gem_hash_view_cell_std_new("<span color=\"Blue\">Company</span>");  gem_hash_view_set_item(GEM_HASH_VIEW(cntview),  											 AB_IV_COMPANY,  											 GEM_HASH_VIEW_CELL(cell)); 	gtk_widget_set_size_request (gem_hash_view_cell_std_get_entry                               (GEM_HASH_VIEW_CELL_STD(cell)), 215, -1);	hbox = gtk_hbox_new (FALSE, 0);  gtk_widget_set_size_request (hbox, -1, -1);  gtk_box_pack_start (GTK_BOX (hbox), cell, FALSE, FALSE, 0);  gtk_box_pack_start (GTK_BOX (base->layout), hbox,  FALSE, FALSE, 0); 						/* Department */  cell = gem_hash_view_cell_std_new("<span color=\"Blue\">Department</span>");  gem_hash_view_set_item(GEM_HASH_VIEW(cntview),  											 AB_IV_DEPART,  											 GEM_HASH_VIEW_CELL(cell)); 	gtk_widget_set_size_request (gem_hash_view_cell_std_get_entry                               (GEM_HASH_VIEW_CELL_STD(cell)), 215, -1);	hbox = gtk_hbox_new (FALSE, 0);  gtk_widget_set_size_request (hbox, -1, -1);  gtk_box_pack_start (GTK_BOX (hbox), cell, FALSE, FALSE, 0);  gtk_box_pack_start (GTK_BOX (base->layout), hbox,  FALSE, FALSE, 0);      /* Website */  cell = gem_hash_view_cell_std_new("<span color=\"Blue\">Website</span>");  gem_hash_view_set_item(GEM_HASH_VIEW(cntview),  											 AB_IV_WEBSITE,  											 GEM_HASH_VIEW_CELL(cell)); 	gtk_widget_set_size_request (gem_hash_view_cell_std_get_entry                               (GEM_HASH_VIEW_CELL_STD(cell)), 215, -1);	hbox = gtk_hbox_new (FALSE, 0);  gtk_widget_set_size_request (hbox, -1, -1);  gtk_box_pack_start (GTK_BOX (hbox), cell, FALSE, FALSE, 0);  gtk_box_pack_start (GTK_BOX (base->layout), hbox,  FALSE, FALSE, 0);       /* Email */  cell = gem_hash_view_cell_std_new("<span color=\"Blue\">Email</span>");  gem_hash_view_set_item(GEM_HASH_VIEW(cntview),  											 AB_IV_EMAIL,  											 GEM_HASH_VIEW_CELL(cell)); 	gtk_widget_set_size_request (gem_hash_view_cell_std_get_entry                               (GEM_HASH_VIEW_CELL_STD(cell)), 215, -1);	hbox = gtk_hbox_new (FALSE, 0);  gtk_widget_set_size_request (hbox, -1, -1);  gtk_box_pack_start (GTK_BOX (hbox), cell, FALSE, FALSE, 0);  gtk_box_pack_start (GTK_BOX (base->layout), hbox,  FALSE, FALSE, 0);     	/* Image Cell */  cell = gem_hash_view_cell_image_new ("<span color=\"Blue\">Picture</span>");  gem_hash_view_cell_set_visible (GEM_HASH_VIEW_CELL(cell), 		    												  TRUE);  gem_hash_view_cell_image_set_buddy (GEM_HASH_VIEW_CELL_IMAGE (cell), image);    picpath =        g_build_filename (gem_env_get_resource_path(), "/pixmaps/icon00.png", NULL);    gem_hash_view_cell_set_value (GEM_HASH_VIEW_CELL_IMAGE (cell), "icon00.png");  gem_hash_view_set_item (GEM_HASH_VIEW (cntview),                          AB_IV_PICTURE,                          GEM_HASH_VIEW_CELL (cell));                           	gtk_widget_set_size_request (gem_hash_view_cell_std_get_entry                               (GEM_HASH_VIEW_CELL_STD(cell)), 215, -1);	hbox = gtk_hbox_new (FALSE, 0);  gtk_widget_set_size_request (hbox, -1, -1);  gtk_box_pack_start (GTK_BOX (hbox), cell, FALSE, FALSE, 0);  gtk_box_pack_start (GTK_BOX (base->layout), hbox,  FALSE, FALSE, 0);          /* Ringtone */  cell = gem_hash_view_cell_std_new("<span color=\"Blue\">Ringtone</span>");  gem_hash_view_set_item(GEM_HASH_VIEW(cntview),  											 AB_IV_RINGTONE,  											 GEM_HASH_VIEW_CELL(cell)); 	gtk_widget_set_size_request (gem_hash_view_cell_std_get_entry                               (GEM_HASH_VIEW_CELL_STD(cell)), 215, -1);	hbox = gtk_hbox_new (FALSE, 0);  gtk_widget_set_size_request (hbox, -1, -1);  gtk_box_pack_start (GTK_BOX (hbox), cell, FALSE, FALSE, 0);  gtk_box_pack_start (GTK_BOX (base->layout), hbox,  FALSE, FALSE, 0);       /* Home Address */  cell = gem_hash_view_cell_std_new("<span color=\"Blue\">Home Address</span>");  gem_hash_view_set_item(GEM_HASH_VIEW(cntview),  											 AB_IV_HADDR_STREET,  											 GEM_HASH_VIEW_CELL(cell)); 	gtk_widget_set_size_request (gem_hash_view_cell_std_get_entry                               (GEM_HASH_VIEW_CELL_STD(cell)), 215, -1);	hbox = gtk_hbox_new (FALSE, 0);  gtk_widget_set_size_request (hbox, -1, -1);  gtk_box_pack_start (GTK_BOX (hbox), cell, FALSE, FALSE, 0);  gtk_box_pack_start (GTK_BOX (base->layout), hbox,  FALSE, FALSE, 0);         /* Business Address */  cell = gem_hash_view_cell_std_new("<span color=\"Blue\">Business Address</span>");  gem_hash_view_set_item(GEM_HASH_VIEW(cntview),  											 AB_IV_BADDR_STREET,  											 GEM_HASH_VIEW_CELL(cell)); 	gtk_widget_set_size_request (gem_hash_view_cell_std_get_entry                               (GEM_HASH_VIEW_CELL_STD(cell)), 215, -1);	hbox = gtk_hbox_new (FALSE, 0);  gtk_widget_set_size_request (hbox, -1, -1);  gtk_box_pack_start (GTK_BOX (hbox), cell, FALSE, FALSE, 0);  gtk_box_pack_start (GTK_BOX (base->layout), hbox,  FALSE, FALSE, 0);           GEM_HASH_VIEW(cntview)->focused_item = AB_IV_LAST_NAME;	return;}GtkWidget *ui_comp_cnt_edit_view_new (void){	g_print("%s(): entering \n", __FUNCTION__);	return gtk_widget_new(UI_COMP_TYPE_CNT_EDIT_VIEW,												NULL);}voidui_comp_cnt_edit_view_update (UICompCntEditView	*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 + -