📄 libgnome-gnome-program.html
字号:
/* last but not least a special option that collects filenames */ { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &remaining_args, "Special option that collects any remaining arguments for us" }, { NULL } }; GOptionContext *option_context; GnomeProgram *my_app; option_context = g_option_context_new ("my-app"); /* if you are using any libraries that have command line options * of their own and provide a GOptionGroup with them, you can * add them here as well using <ahref="/usr/share/gtk-doc/html/glib/glib-Commandline-option-parser.html#g-option-context-add-group"><code class="function">g_option_context_add_group()</code></a> */ /* now add our own application's command-line options. If you * are using gettext for translations, you should be using * GETTEXT_PACKAGE here instead of NULL */ g_option_context_add_main_entries (option_context, option_entries, NULL); /* We assume PACKAGE and VERSION are set to the program name and version * number respectively. Also, assume that 'option_entries' is a global * array of GOptionEntry structures. */ my_app = gnome_program_init(PACKAGE, VERSION, LIBGNOMEUI_MODULE, argc, argv, GNOME_PARAM_GOPTION_CONTEXT, option_context, GNOME_PARAM_NONE); /* parse remaining command-line arguments that are not * options (e.g. filenames or URIs or whatever), if any */ if (remaining_args != NULL) { gint i, num_args; num_args = g_strv_length (remaining_args); for (i = 0; i < num_args; ++i) { /* process remaining_args[i] here */ } g_strfreev (remaining_args); remaining_args = NULL; }</pre></div><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>app_id</code></em> :</span></td><td> Application ID string.</td></tr><tr><td><span class="term"><em class="parameter"><code>app_version</code></em> :</span></td><td> Application version string.</td></tr><tr><td><span class="term"><em class="parameter"><code>module_info</code></em> :</span></td><td> The module to init with this program.</td></tr><tr><td><span class="term"><em class="parameter"><code>argc</code></em> :</span></td><td> The number of commmand line arguments contained in <em class="parameter"><code>argv</code></em>.</td></tr><tr><td><span class="term"><em class="parameter"><code>argv</code></em> :</span></td><td> A string array of command line arguments.</td></tr><tr><td><span class="term"><em class="parameter"><code>first_property_name</code></em> :</span></td><td> The first item in a <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated list of attributename and value pairs (so this will be an attribute name or <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a>).</td></tr><tr><td><span class="term"><em class="parameter"><code>...</code></em> :</span></td><td> The continuation of a <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated list of attribute name/valuepairs.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> A <a href="libgnome-gnome-program.html#GnomeProgram"><span class="type">GnomeProgram</span></a> instance representing the current application.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2787602"></a><h3><a name="gnome-program-initv"></a>gnome_program_initv ()</h3><a class="indexterm" name="id2787614"></a><pre class="programlisting"><a href="libgnome-gnome-program.html#GnomeProgram">GnomeProgram</a>* gnome_program_initv (<ahref="/usr/share/gtk-doc/html/gobject/gobject-Type-Information.html#GType">GType</a> type, const char *app_id, const char *app_version, const <a href="libgnome-gnome-program.html#GnomeModuleInfo">GnomeModuleInfo</a> *module_info, int argc, char **argv, const char *first_property_name, va_list args);</pre><p>Provides a non-varargs form of <a href="libgnome-gnome-program.html#gnome-program-init"><code class="function">gnome_program_init()</code></a>. Users will rarely needto call this function directly.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>type</code></em> :</span></td><td> The type of application to be initialized (usually<span class="type">GNOME_TYPE_PROGRAM</span>).</td></tr><tr><td><span class="term"><em class="parameter"><code>app_id</code></em> :</span></td><td> Application ID string.</td></tr><tr><td><span class="term"><em class="parameter"><code>app_version</code></em> :</span></td><td> Application version string.</td></tr><tr><td><span class="term"><em class="parameter"><code>module_info</code></em> :</span></td><td> The modules to init with the application.</td></tr><tr><td><span class="term"><em class="parameter"><code>argc</code></em> :</span></td><td> The number of command line arguments contained in <em class="parameter"><code>argv</code></em>.</td></tr><tr><td><span class="term"><em class="parameter"><code>argv</code></em> :</span></td><td> A string array of command line arguments.</td></tr><tr><td><span class="term"><em class="parameter"><code>first_property_name</code></em> :</span></td><td> The first item in a <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated list of attributename/value.</td></tr><tr><td><span class="term"><em class="parameter"><code>args</code></em> :</span></td><td> The remaining elements in the <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a> terminated list (of which<em class="parameter"><code>first_property_name</code></em> is the first element).</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> A <a href="libgnome-gnome-program.html#GnomeProgram"><span class="type">GnomeProgram</span></a> instance representing the current application.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2787893"></a><h3><a name="gnome-program-get"></a>gnome_program_get ()</h3><a class="indexterm" name="id2787906"></a><pre class="programlisting"><a href="libgnome-gnome-program.html#GnomeProgram">GnomeProgram</a>* gnome_program_get (void);</pre><p>Retrieves an object that stored information about the application's state.Other functions assume this will always return a <a href="libgnome-gnome-program.html#GnomeProgram"><span class="type">GnomeProgram</span></a> object which(if not <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a>) has already been initialized.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> The application's <a href="libgnome-gnome-program.html#GnomeProgram"><span class="type">GnomeProgram</span></a> instance, or <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a> if it does notexist.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2787986"></a><h3><a name="gnome-program-get-human-readable-name"></a>gnome_program_get_human_readable_name ()</h3><a class="indexterm" name="id2788000"></a><pre class="programlisting">const char* gnome_program_get_human_readable_name (<a href="libgnome-gnome-program.html#GnomeProgram">GnomeProgram</a> *program);</pre><p>This function returns a pointer to a static string that theapplication has provided as a human readable name. The appshould provide the name with the <a href="libgnome-gnome-program.html#GNOME-PARAM-HUMAN-READABLE-NAME:CAPS"><span class="type">GNOME_PARAM_HUMAN_READABLE_NAME</span></a>init argument. Returns <ahref="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a> if no name was set.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>program</code></em> :</span></td><td> The application object</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> Application human-readable name string.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2788086"></a><h3><a name="gnome-program-get-app-id"></a>gnome_program_get_app_id ()</h3><a class="indexterm" name="id2788099"></a><pre class="programlisting">const char* gnome_program_get_app_id (<a href="libgnome-gnome-program.html#GnomeProgram">GnomeProgram</a> *program);</pre><p>This function returns a pointer to a static string that theapplication has provided as an identifier. This is not meant as ahuman-readable identifier so much as a unique identifier forprograms and libraries.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>program</code></em> :</span></td><td> The program object</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> Application ID string.</td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><a name="id2788165"></a><h3><a name="gnome-program-get-app-version"></a>gnome_program_get_app_version ()</h3><a class="indexterm" name="id2788178"></a><pre class="programlisting">const char* gnome_program_get_app_version (<a href="libgnome-gnome-program.html#GnomeProgram">GnomeProgram</a> *program);</pre><p>This function returns a pointer to a static string that theapplication has provided as a version number. This is not meant as ahuman-readable identifier so much as a unique identifier forprograms and libraries.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><em class="parameter"><code>program</code></em> :</span></td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -