网站大量收购独家精品文档,联系QQ:2885784924

19-GnomeHello源代码.pdf

  1. 1、本文档共11页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 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

文档评论(0)

l215322 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档