- 1、本文档共11页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
19-GnomeHello源代码
下载
附录A GnomeHello源代码
这里是本书中多次用到的 G n o m e H e l l o的源代码。它是学习 G n o m e编程非常好的材料。源
代码共分为五个文件,分别是 h e l l o . c、a p p . c、a p p . h、m e n u . c以及m e n u . h。
A.1 第一部分:hello.c
#include config.h
#include gnome.h
#include app.h
static void session_die(GnomeClient* client, gpointer client_data);
static gint save_session(GnomeClient *client, gint phase,
GnomeSaveStyle save_style,
gint is_shutdown, GnomeInteractStyle interact_style,
gint is_fast, gpointer client_data);
static int greet_mode = FALSE;
static char* message = NULL;
static char* geometry = NULL;
struct poptOption options[] = {
{
g r e e t ,
‘g’,
P O P T _ A R G _ N O N E ,
g r e e t _ m o d e ,
0 ,
N_(Say hello to specific people listed on the command line),
N U L L
} ,
{
m e s s a g e ,
‘m’,
P O P T _ A R G _ S T R I N G ,
m e s s a g e ,
0 ,
N_(Specify a message other than \Hello, World!\),
N _ ( M E S S A G E )
} ,
第五部分 附 录
{
g e o m e t r y ,
‘\ 0’,
P O P T _ A R G _ S T R I N G ,
g e o m e t r y ,
0 ,
N_(Specify the geometry of the main window),
N _ ( G E O M E T R Y )
} ,
{
N U L L ,
‘\ 0’,
0 ,
N U L L ,
0 ,
N U L L ,
N U L L
}
} ;
int
main(int argc, char* argv[])
{
GtkWidget* app;
poptContext pctx;
char** args;
int i;
GSList* greet = NULL;
GnomeClient* client;
bindtextdomain(PACKAGE, GNOMELOCALEDIR);
t e x t d o m a i n ( P A C K A G E ) ;
gnome_init_with_popt_table(PACKAGE, VERSION, argc, argv,
options, 0, pctx);
/* 参数分析* /
args = poptGetArgs(pctx);
if (greet_mode args)
{
i = 0;
while (args[i] != NULL)
{
greet = g_slist_prepend(greet, args[i]);
+ + i ;
294使用第五部分 附 录
下载
}/* Put them in order */
greet = g_slist_reverse(greet);
}
else if (greet_mode args == NULL)
{
g_error(_(You must specify someone to greet.));
}
else if (args != NULL)
{
g_error(_(Command line arguments are only allowed with --greet.));
}
e l s e
{
g_assert(!greet_mode args == NULL);
}
p o p t F r e e C o n t e x t ( p c t x ) ;
/* 会话管理* /
client = gnome_master_client ();
gtk_signal_connect (GTK_OBJECT (cli
您可能关注的文档
- (Annals of the Brazilian Academy of Sciences).pdf
- !!Chapter 1 Introduction to management and organizaitions.pdf
- (07 TMC) Bandwidth sharing schemes for multimedia traffic in the IEEE 802.11e contention-based WLANs.pdf
- (2007-Scarpellini)High dosage rifaximin for the treatment of small intestinal bacterial overgrowth.pdf
- (NH4)0.5V2O5 nanobelt.pdf
- (PCF中文)2007119163812.pdf
- !!Large-area submicron replica molding of porous low-k dielectric films and application to photonic.pdf
- (psychology, self-help) Bipolar Disorder - Stories of Coping and Courage.pdf
- (AUO)DMO_G085VW01_V0_preliminary_spec_Aug2009.pdf
- (Workshop Chairs) ECDL WS Generalized Documents 2001 Applications of Information Hiding and.pdf
- 4.1 陆地水体及其关系 课件高二上学期地理中图版(2019)选择性必修一.pptx
- 混凝土结构与砌体结构设计习题集 .pdf
- 统编版语文四年级下册 22.古诗三首 课件(共50张PPT).pptx
- 青海2024行测笔试真题及答案 .pdf
- 2.1 充分发挥市场在资源配置中的决定性作用 课件-高中政治统编版必修二经济与社会.pptx
- 27.巨人的花园 课件(共58张PPT).pptx
- 统编版语文一年级下册5 树和喜鹊 第1课时 课件(共37张PPT).pptx
- 2.1 充分发挥市场在资源配置中的决定性作用 课件政治一轮复习统编版必修二经济与社会.pptx
- 贵港市平南县2024届小升初考试语文试卷含答案 .pdf
- 小学期末考试质量分析 .pdf
文档评论(0)