?? uicompmainwindow.c
字號(hào):
/* 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 <gpe/gpeskwindow.h>#include <gem.h>#include <gemhashview.h>#include <uicompmainwindow.h>#include <uicompskwindow.h>#include <uicompcntlistview.h>#include <uicompcnteditview.h> #include <uicompwinmgr.h>static voidsoftkey_activated_cb (GpeSKWindow *window, gint nr, gpointer user_data){ g_print("%s(): entering\n", __FUNCTION__); if (nr == UI_COMP_SK_LEFT) { g_print("%s(): left activated\n", __FUNCTION__); } else if (nr == UI_COMP_SK_RIGHT) { GemApplication *app = gem_application_get_instance(); gem_application_quit(app); } return;}/**************************** qzh Jan 31 *************************************/static voidui_comp_contact_view_softkey_activated_cb (GpeSKWindow *window, gint nr, GemHashView *view){ gboolean ret = FALSE; if (nr == UI_COMP_SK_LEFT) { g_print ("%s(): Left Softkey\n", __FUNCTION__); /* if (view && gem_hash_view_get_editable (view)) { ab_contact_t *contact = NULL; contact = abook_contact_parse_from_view_sim (AB_ITEMS_VIEW (view)); if (contact) { gboolean update = FALSE; gpointer uid = NULL; ab_contact_get_field (contact, AB_IV_UID, (gpointer) & uid); if (uid) { update = TRUE; } g_print ("%s(): update = %s\n", __FUNCTION__, update ? "TRUE" : "FALSE"); if (update) { ab_fid_t fields[] = { AB_IV_LAST_NAME, AB_IV_MOBILE_NUM, AB_FIELD_ID_INVALID }; ab_update_contact (abook_enabler_sim_session (), contact, fields); if (TRUE) { gchar *name = NULL; gchar *num = NULL; gint *index = NULL; ab_contact_t *update_contact = NULL; ab_get_contact (abook_enabler_sim_session (), uid, &update_contact); ab_contact_print (update_contact); ab_contact_get_field (update_contact, AB_IV_LAST_NAME, (gpointer) & name); ab_contact_get_field (update_contact, AB_IV_MOBILE_NUM, (gpointer) & num); ab_contact_get_field (update_contact, CNT_SIM_INDEX, (gpointer) & index); if (*index != -1) { abook_iac_ps_update_contact (*index, name, num); } g_free (name); g_free (num); g_free (index); ab_contact_free (update_contact); } } else { gchar *uidstr = NULL; gchar *name = NULL; gchar *num = NULL; ab_add_contact (abook_enabler_sim_session (), contact); ab_contact_print (contact); ab_contact_get_field (contact, AB_IV_UID, (gpointer) & uid); ab_contact_get_field (contact, AB_IV_LAST_NAME, (gpointer) & name); ab_contact_get_field (contact, AB_IV_MOBILE_NUM, (gpointer) & num); if (uid) { uidstr = g_new0 (gchar, 36 + 1); uuid_unparse (uid, uidstr); } ab_items_view_set_value (AB_ITEMS_VIEW (view), AB_IV_UID, uidstr); abook_iac_ps_add_contact (name, num, uidstr); g_free (uidstr); g_free (name); g_free (num); } AB_ITEMS_VIEW (view)->status = AB_IV_STATUS_SAVE; g_free (uid); } ab_contact_free (contact); } ret = TRUE;*/ } else if (nr == UI_COMP_SK_RIGHT) { g_print ("%s(): Right Softkey\n", __FUNCTION__); if (view) { view->status = GEM_HV_STATUS_CANCEL; } ret = TRUE; } if (ret) { gtk_widget_hide_all (GTK_WIDGET (window)); } return;}//**************************** qzh ************************************void action_cnt_add_contact_cb(void){ GtkWidget *sub_window = NULL; GtkWidget *view = NULL; GemApplication *app = NULL; g_print("%s(): add a new contact .\n", __FUNCTION__);// g_print("%s(): entering\n", __FUNCTION__); //GtkWidget *sub_window = NULL; GtkWidget *cntview = NULL; g_print("\n%s() : invoke the ui_comp_cont_edit_view_new()\n",__FUNCTION__); cntview = ui_comp_cnt_edit_view_new(); sub_window = ui_comp_skwindow_new(cntview, "Save", "Cancel", "", NULL, NULL); g_signal_connect(G_OBJECT(sub_window), "softkey_activated", G_CALLBACK(ui_comp_contact_view_softkey_activated_cb), GEM_HASH_VIEW(cntview)); ui_comp_winmgr_register_window(UI_COMP_SKW_CNT_VIEW, sub_window); g_signal_connect(G_OBJECT(sub_window), "show", G_CALLBACK(softkey_activated_cb), NULL); g_print("%s() : add contact is ing .\n",__FUNCTION__); view = ui_comp_skwindow_get_view(UI_COMP_SKWINDOW(sub_window)); app = gem_application_get_instance(); gem_application_set_main_window(app, sub_window); gem_application_run(app); gem_application_destroy(app); g_print("%s() : add contact is finished .\n",__FUNCTION__); return;}//**************************** qzh ************************************static gchar * uidesc = " \ <ui>\ <popup action=\"PopupLeft\">\ <menuitem name=\"add_cnt\" action=\"AddCnt\"/>\ <menuitem name=\"menu2\" action=\"Menu2\"/>\ </popup>\ </ui>\";static GtkActionEntry actions[] = { {"AddCnt", NULL, "Add Contact", "", "none",action_cnt_add_contact_cb }, {"Menu2", NULL, "Menu Item2", "", "none", NULL}, {"PopupLeft", NULL, "Popup", "", "none", NULL},};GtkWidget *ui_comp_main_window_new(){ GtkWidget *window = NULL; GtkWidget *cntview = NULL; g_print("%s(): invoke the ui_comp_cnt_list_view_new()\n",__FUNCTION__); cntview = ui_comp_cnt_list_view_new(); window = ui_comp_skwindow_new(cntview, "Options", "Exit", uidesc, actions, G_N_ELEMENTS(actions)); g_signal_connect(G_OBJECT(window), "softkey_activated", G_CALLBACK(softkey_activated_cb), NULL); ui_comp_winmgr_register_window(UI_COMP_SKW_CNT_VIEW, window); return window;}/*vi:ts=2:nowrap:ai:expandtab */
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -