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



I don't  think the code after you organize it is ok because the
variable "node" always will be empty

> 
> Don't init gtk unless you are going to use it.
> 
> 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 }
>          };
> 
>         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_init_with_args (&argc, &argv,NULL,options,NULL,NULL);
> 
>    gtk_main ();
>    return 0;
> 
> }
> 


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



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