[KLUG Members] Fw: [blug-prog] Help with kdevelope
komal
members@kalamazoolinux.org
Fri, 20 Feb 2004 19:48:08 +0530
----- Original Message -----
From: "komal" <agencies_ad1@sancharnet.in>
To: <linux-bangalore-programming@yahoogroups.com>
Sent: Thursday, February 19, 2004 8:16 PM
Subject: [blug-prog] Help with kdevelope
> Hi
> I am using kdevelope with Mandrake 9.2. I have used kdevelope project
option
> to create GNOME application but it is showing errors which I am unable to
> understand.Pls guide me.
>
> Thank you
>
> Komal
>
>
/***************************************************************************
> main.c - description
> -------------------
> begin : Wed Feb 18 23:47:25 UTC 2004
> copyright : (C) 2004 by
> email :
>
>
***************************************************************************/
>
>
/***************************************************************************
> *
*
> * This program is free software; you can redistribute it and/or modify
*
> * it under the terms of the GNU General Public License as published by
*
> * the Free Software Foundation; either version 2 of the License, or
*
> * (at your option) any later version.
*
> *
*
>
>
***************************************************************************/
>
> /*** gnome */
>
> #include <config.h>
> #include <gnome.h>
>
> #include "app.h"
>
>
> static gint 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);
>
>
> /*** gnome-popttable */
> static int greet_mode = FALSE;
> static char* message = NULL;
> static char* geometry = NULL;
>
> struct poptOption options[] = {
> {
> "greet",
> 'g',
> POPT_ARG_NONE,
> &greet_mode,
> 0,
> N_("Say hello to specific people listed on the command line"),
> NULL
> },
> {
> "message",
> 'm',
> POPT_ARG_STRING,
> &message,
> 0,
> N_("Specify a message other than \"Hello, World!\""),
> N_("MESSAGE")
> },
> {
> "geometry",
> '\0',
> POPT_ARG_STRING,
> &geometry,
> 0,
> N_("Specify the geometry of the main window"),
> N_("GEOMETRY")
> },
> {
> NULL,
> '\0',
> 0,
> NULL,
> 0,
> NULL,
> NULL
> }
> };
> /* gnome-popttable ***/
>
> int
> main(int argc, char* argv[])
> {
> /*** gnome-parsing */
> GtkWidget* app;
>
> poptContext pctx;
>
> char** args;
> int i;
>
> GSList* greet = NULL;
>
> GnomeClient* client;
>
> bindtextdomain(PACKAGE, GNOMELOCALEDIR);
> textdomain(PACKAGE);
>
> gnome_init_with_popt_table(PACKAGE, VERSION, argc, argv,
> options, 0, &pctx);
>
> /* Argument parsing */
>
> args = poptGetArgs(pctx);
>
> if (greet_mode && args)
> {
> i = 0;
> while (args[i] != NULL)
> {
> greet = g_slist_prepend(greet, args[i]);
> ++i;
> }
> /* 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."));
> }
> else
> {
> g_assert(!greet_mode && args == NULL);
> }
>
> poptFreeContext(pctx);
> /* gnome-parsing ***/
>
> /* Session Management */
>
> /*** gnome-client */
> client = gnome_master_client ();
> gtk_signal_connect (GTK_OBJECT (client), "save_yourself",
> GTK_SIGNAL_FUNC (save_session), argv[0]);
> gtk_signal_connect (GTK_OBJECT (client), "die",
> GTK_SIGNAL_FUNC (session_die), NULL);
> /* gnome-client ***/
>
>
> /* Main app */
>
> app = gnome_app_new(message, geometry, greet);
>
> g_slist_free(greet);
>
> /*** gnome-main */
> gtk_widget_show_all(app);
>
> gtk_main();
>
> return 0;
> /* gnome-main ***/
> }
>
> /*** gnome-save-session */
> static gint
> save_session (GnomeClient *client, gint phase, GnomeSaveStyle save_style,
> gint is_shutdown, GnomeInteractStyle interact_style,
> gint is_fast, gpointer client_data)
> {
> gchar** argv;
> guint argc;
>
> /* allocate 0-filled, so it will be NULL-terminated */
> argv = g_malloc0(sizeof(gchar*)*4);
> argc = 1;
>
> argv[0] = client_data;
>
> if (message)
> {
> argv[1] = "--message";
> argv[2] = message;
> argc = 3;
> }
>
> gnome_client_set_clone_command (client, argc, argv);
> gnome_client_set_restart_command (client, argc, argv);
>
> return TRUE;
> }
> /* gnome-save-session ***/
>
> /*** gnome-session-die */
> static gint
> session_die(GnomeClient* client, gpointer client_data)
> {
> gtk_main_quit ();
> return TRUE;
> }
> /* gnome-session-die ***/
>
> /* gnome ***/
>
>
>
> main.c:102: warning: assignment from incompatible pointer type
> main.c:144: error: too many arguments to function `gnome_app_new'
> main.c:94: warning: statement with no effect
> main.c:95: warning: statement with no effect
> gmake: *** [main.o] Error 1
> *** failed ***
>
>
>
>
> Before posting to this list, read the list rules FIRST!
>
> http://linux-bangalore.org/discussions/rules.php
>
> Yahoo! Groups Links
>
> <*> To visit your group on the web, go to:
> http://groups.yahoo.com/group/linux-bangalore-programming/
>
> <*> To unsubscribe from this group, send an email to:
> linux-bangalore-programming-unsubscribe@yahoogroups.com
>
> <*> Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/
>
>