How to put send an option to GUI app in a console wothout DISPLAY

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

I have a GUI program and one of the thing is that I want my user to be
able to parse options to the program (e.g. adding new record) from the
command line without DISPLAY variable defined

basically I want the program when it start to check if the user parse
the option "--add <name>"  then just add the name to the db and exist
(The user in this case will run the program in a console and there is
no DISPLAY defined), and if the user didn't parse any option then run
the program GUI in the defined DISPLAY

I tried gtk_init_with_args but this will not work if the DISPLAY is undefined


any help ?

Here is my code

int
main (int argc, char *argv[])
{
		static gchar *node = NULL;
        GOptionEntry options[] = {
                { "new-node", 'n', 0, G_OPTION_ARG_STRING, &node,
_("Add new node"), _("hostname") },
                		{ NULL, '\0', 0, 0, NULL, NULL, NULL }
        };
	gtk_init_with_args (&argc, &argv,NULL,options,NULL,NULL);

	if(node) {
	         g_print("NEW NODE\n");
	         g_print("node=%s)\n",node);	 
		 return 0;  // now exit because the user don't want the program, he
just want to add something
        }
  
  gtk_main ();
  return 0;

}

-- 
Best Regards,
--------------------
-*- If Linux doesn't have the solution, you have the wrong problem -*-
_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list


[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux