static void gnac_ui_init_unique(void) { #ifdef HAVE_LIBUNIQUE /* We only want a single instance of gnac to be running */ app = unique_app_new_with_commands("org.gnome.Gnac", NULL, "add-files", UNIQUE_CMD_ADD, "debug" , UNIQUE_CMD_DEBUG, "verbose" , UNIQUE_CMD_VERBOSE, NULL); g_signal_connect(app, "message-received", G_CALLBACK(gnac_ui_message_received_cb), NULL); if (unique_app_is_running(app)) { libgnac_info(_("An instance of Gnac is already running")); UniqueResponse response; /* Give the focus to the running instance */ response = unique_app_send_message(app, UNIQUE_ACTIVATE, NULL); /* Transmit the debug option */ if (options.debug) { response = unique_app_send_message(app, UNIQUE_CMD_DEBUG, NULL); if (response != UNIQUE_RESPONSE_OK) { libgnac_warning(_("Failed to transmit the debug option")); } /* Transmit the verbose option */ } else if (options.verbose) { response = unique_app_send_message(app, UNIQUE_CMD_VERBOSE, NULL); if (response != UNIQUE_RESPONSE_OK) { libgnac_warning(_("Failed to transmit the verbose option")); } } /* Transmit filenames */ if (options.filenames) { UniqueMessageData *message = unique_message_data_new(); gchar **uris = gnac_utils_get_filenames_from_cmd_line(options.filenames); g_strfreev(options.filenames); if (!unique_message_data_set_uris(message, uris)) { libgnac_warning(_("Failed to convert some uris")); } g_strfreev(uris); response = unique_app_send_message(app, UNIQUE_CMD_ADD, message); unique_message_data_free(message); if (response != UNIQUE_RESPONSE_OK) { libgnac_warning(_("Failed to transmit filenames")); } else { libgnac_info(_("Filenames transmitted to the running instance")); } } g_object_unref(app); gnac_exit(response == UNIQUE_RESPONSE_OK); } #endif /* HAVE_LIBUNIQUE */ }
int main (int argc, char **argv) { UniqueApp *app; GtkWidget *window; g_thread_init (NULL); bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); gtk_init (&argc, &argv); /* TODO: use GOption to parse arguments */ app = unique_app_new_with_commands ("com.intel.Bisho", NULL, "callback", COMMAND_CALLBACK, NULL); if (unique_app_is_running (app)) { UniqueResponse response; if (argc != 2) { response = unique_app_send_message (app, UNIQUE_ACTIVATE, NULL); } else { UniqueMessageData *msg; msg = unique_message_data_new (); unique_message_data_set_uris (msg, argv + 1); response = unique_app_send_message (app, COMMAND_CALLBACK, msg); unique_message_data_free (msg); } if (response == UNIQUE_RESPONSE_OK) goto done; } load_modules (); window = bisho_window_new (); unique_app_watch_window (app, GTK_WINDOW (window)); g_signal_connect (app, "message-received", G_CALLBACK (unique_message_cb), window); g_signal_connect (window, "delete-event", gtk_main_quit, NULL); gtk_widget_show (window); gtk_main (); done: g_object_unref (app); return 0; }
static gint luaH_unique_send_message(lua_State *L) { if (!application) luaL_error(L, "unique app not setup"); if (!unique_app_is_running(application)) luaL_error(L, "no other instances running"); const gchar *text = luaL_checkstring(L, 1); UniqueMessageData *data = unique_message_data_new(); unique_message_data_set_text(data, text, -1); unique_app_send_message(application, 1, data); unique_message_data_free(data); return 0; }
void unique_instance(int argc, char **args, UniqueApp *app) { int i = 0; /* FIXME - rework. */ for(; i < argc; ++i) { if (strcmp( args[i], "next-socket" ) == 0) { UniqueMessageData* data = unique_message_data_new(); unique_message_data_set_text(data, args[i], strlen(args[i])); unique_app_send_message(app, COMMAND_PRINT_XID, data); unique_message_data_free(data); } } g_object_unref(app); }
int main (int argc, char *argv[]) { UniqueApp *app; UniqueMessageData *msg; GError *error = NULL; GOptionContext *context; GOptionGroup *debug; gulong debug_flags = 0; LifereaDBus *dbus = NULL; const gchar *initial_state = "shown"; gchar *feed = NULL; int initialState; gboolean show_tray_icon, start_in_tray; #ifdef USE_SM gchar *opt_session_arg = NULL; #endif GOptionEntry entries[] = { { "mainwindow-state", 'w', 0, G_OPTION_ARG_STRING, &initial_state, N_("Start Liferea with its main window in STATE. STATE may be `shown', `iconified', or `hidden'"), N_("STATE") }, #ifdef USE_SM { "session", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &opt_session_arg, NULL, NULL }, #endif { "version", 'v', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, show_version, N_("Show version information and exit"), NULL }, { "add-feed", 'a', 0, G_OPTION_ARG_STRING, &feed, N_("Add a new subscription"), N_("uri") }, { NULL } }; GOptionEntry debug_entries[] = { { "debug-all", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, debug_entries_parse_callback, N_("Print debugging messages of all types"), NULL }, { "debug-cache", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, debug_entries_parse_callback, N_("Print debugging messages for the cache handling"), NULL }, { "debug-conf", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, debug_entries_parse_callback, N_("Print debugging messages for the configuration handling"), NULL }, { "debug-db", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, debug_entries_parse_callback, N_("Print debugging messages of the database handling"), NULL }, { "debug-gui", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, debug_entries_parse_callback, N_("Print debugging messages of all GUI functions"), NULL }, { "debug-html", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, debug_entries_parse_callback, N_("Enables HTML rendering debugging. Each time Liferea renders HTML output it will also dump the generated HTML into ~/.liferea_1.6/output.xhtml"), NULL }, { "debug-net", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, debug_entries_parse_callback, N_("Print debugging messages of all network activity"), NULL }, { "debug-parsing", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, debug_entries_parse_callback, N_("Print debugging messages of all parsing functions"), NULL }, { "debug-performance", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, debug_entries_parse_callback, N_("Print debugging messages when a function takes too long to process"), NULL }, { "debug-trace", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, debug_entries_parse_callback, N_("Print debugging messages when entering/leaving functions"), NULL }, { "debug-update", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, debug_entries_parse_callback, N_("Print debugging messages of the feed update processing"), NULL }, { "debug-vfolder", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, debug_entries_parse_callback, N_("Print debugging messages of the search folder matching"), NULL }, { "debug-verbose", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, debug_entries_parse_callback, N_("Print verbose debugging messages"), NULL }, { NULL } }; if (!g_thread_supported ()) g_thread_init (NULL); #ifdef ENABLE_NLS bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); #endif debug = g_option_group_new ("debug", _("Print debugging messages for the given topic"), _("Print debugging messages for the given topic"), &debug_flags, NULL); g_option_group_set_translation_domain(debug, GETTEXT_PACKAGE); g_option_group_add_entries (debug, debug_entries); context = g_option_context_new (NULL); g_option_context_set_summary (context, N_("Liferea, the Linux Feed Reader")); g_option_context_set_description (context, N_("For more information, please visit http://liferea.sourceforge.net/")); g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE); g_option_context_set_translation_domain(context, GETTEXT_PACKAGE); g_option_context_add_group (context, debug); g_option_context_add_group (context, gtk_get_option_group (FALSE)); g_option_context_parse (context, &argc, &argv, &error); g_option_context_free (context); if (error) { g_print ("Error parsing options: %s\n", error->message); } set_debug_level (debug_flags); /* Configuration necessary for network options, so it has to be initialized before update_init() */ conf_init (); #ifdef USE_DBUS dbus_g_thread_init (); #endif /* We need to do the network initialization here to allow network-manager to be setup before gtk_init() */ update_init (); gtk_init (&argc, &argv); /* Single instance checks */ app = unique_app_new_with_commands ("net.sourceforge.liferea", NULL, "add_feed", COMMAND_ADD_FEED, NULL); if (unique_app_is_running (app)) { g_print ("Liferea is already running\n"); unique_app_send_message (app, UNIQUE_ACTIVATE, NULL); if (feed) { msg = unique_message_data_new (); unique_message_data_set_text (msg, feed, -1); unique_app_send_message (app, COMMAND_ADD_FEED, msg); } return 1; } else { g_signal_connect (app, "message-received", G_CALLBACK (message_received_cb), NULL); } /* GTK theme support */ g_set_application_name (_("Liferea")); gtk_window_set_default_icon_name ("liferea"); debug_start_measurement (DEBUG_DB); /* order is important! */ db_init (); /* initialize sqlite */ xml_init (); /* initialize libxml2 */ #ifdef HAVE_LIBNOTIFY notification_plugin_register (&libnotify_plugin); #endif social_init (); /* initialize social bookmarking */ #ifdef USE_DBUS dbus = liferea_dbus_new (); #else debug0 (DEBUG_GUI, "Compiled without DBUS support."); #endif #ifdef USE_AVAHI if (conf_get_bool_value (SYNC_AVAHI_ENABLED)) { LifereaAvahiPublisher *avahiPublisher = NULL; debug0 (DEBUG_CACHE, "Registering with AVAHI"); avahiPublisher = liferea_avahi_publisher_new (); liferea_avahi_publisher_publish (avahiPublisher, conf_get_str_value (SYNC_AVAHI_SERVICE_NAME), 23632); } else { debug0 (DEBUG_CACHE, "Avahi support available, but disabled by preferences."); } #else debug0 (DEBUG_CACHE, "Compiled without AVAHI support"); #endif /* how to start liferea, command line takes precedence over preferences */ conf_get_bool_value (SHOW_TRAY_ICON, &show_tray_icon); conf_get_bool_value (START_IN_TRAY, &start_in_tray); if (g_str_equal(initial_state, "iconified")) { initialState = MAINWINDOW_ICONIFIED; } else if (g_str_equal(initial_state, "hidden") || (show_tray_icon && start_in_tray)) { initialState = MAINWINDOW_HIDDEN; } else { initialState = MAINWINDOW_SHOWN; } liferea_shell_create (initialState); g_set_prgname ("liferea"); #ifdef USE_SM /* This must be after feedlist reading because some session managers will tell Liferea to exit if Liferea does not respond to SM requests within a minute or two. This starts the main loop soon after opening the SM connection. */ session_init (BIN_DIR G_DIR_SEPARATOR_S "liferea", opt_session_arg); session_set_cmd (NULL, initialState); #endif signal (SIGTERM, signal_handler); signal (SIGINT, signal_handler); signal (SIGHUP, signal_handler); #ifndef G_OS_WIN32 signal (SIGBUS, fatal_signal_handler); signal (SIGSEGV, fatal_signal_handler); #endif /* Note: we explicitely do not use the gdk_thread_* locking in Liferea because it freezes the program when running Flash applets in gtkmozembed */ runState = STATE_STARTING; debug_end_measurement (DEBUG_DB, "startup"); if (feed) feedlist_add_subscription (feed, NULL, NULL, 0); gtk_main (); g_object_unref (G_OBJECT (dbus)); return 0; }
gint ease_main_main (char** args, int args_length1) { #line 383 "ease-main.c" gint result = 0; GOptionContext* context; UniqueApp* _tmp1_; gboolean _tmp2_; gboolean running; gboolean _tmp7_ = FALSE; GError * _inner_error_ = NULL; #line 61 "ease-main.vala" g_set_application_name ("Ease"); #line 62 "ease-main.vala" gtk_window_set_default_icon_name ("ease"); #line 65 "ease-main.vala" context = g_option_context_new (_ (" - a presentation editor")); #line 68 "ease-main.vala" g_option_context_add_main_entries (context, EASE_MAIN_options, NULL); #line 71 "ease-main.vala" g_option_context_add_group (context, gtk_get_option_group (TRUE)); #line 72 "ease-main.vala" g_option_context_add_group (context, clutter_get_option_group ()); #line 403 "ease-main.c" { gboolean _tmp0_; #line 76 "ease-main.vala" _tmp0_ = g_option_context_parse (context, &args_length1, &args, &_inner_error_); #line 408 "ease-main.c" if (_inner_error_ != NULL) { if (_inner_error_->domain == G_OPTION_ERROR) { goto __catch12_g_option_error; } _g_option_context_free0 (context); g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); g_clear_error (&_inner_error_); return 0; } #line 76 "ease-main.vala" if (!_tmp0_) { #line 420 "ease-main.c" result = 1; _g_option_context_free0 (context); #line 76 "ease-main.vala" return result; #line 425 "ease-main.c" } } goto __finally12; __catch12_g_option_error: { GError * e; e = _inner_error_; _inner_error_ = NULL; { #line 80 "ease-main.vala" fprintf (stdout, _ ("error parsing options: %s\n"), e->message); #line 437 "ease-main.c" result = 1; _g_error_free0 (e); _g_option_context_free0 (context); #line 81 "ease-main.vala" return result; #line 443 "ease-main.c" } } __finally12: if (_inner_error_ != NULL) { _g_option_context_free0 (context); g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code); g_clear_error (&_inner_error_); return 0; } #line 85 "ease-main.vala" ease_main_app = (_tmp1_ = unique_app_new ("org.ease-project.ease", NULL), _g_object_unref0 (ease_main_app), _tmp1_); #line 86 "ease-main.vala" unique_app_add_command (ease_main_app, "Open document", (gint) EASE_MAIN_UNIQUE_COMMAND_OPEN_FILE); #line 87 "ease-main.vala" unique_app_add_command (ease_main_app, "Play document", (gint) EASE_MAIN_UNIQUE_COMMAND_PLAY_FILE); #line 88 "ease-main.vala" unique_app_add_command (ease_main_app, "Create new document", (gint) EASE_MAIN_UNIQUE_COMMAND_SHOW_WELCOME); #line 91 "ease-main.vala" running = (g_object_get (ease_main_app, "is-running", &_tmp2_, NULL), _tmp2_); #line 93 "ease-main.vala" if (!running) { #line 465 "ease-main.c" GeeArrayList* _tmp3_; ClutterBackend* backend; GtkSettings* settings; gint _tmp4_; gint _tmp5_; #line 96 "ease-main.vala" g_signal_connect (ease_main_app, "message-received", (GCallback) __lambda65__unique_app_message_received, NULL); #line 120 "ease-main.vala" gst_init (&args_length1, &args); #line 123 "ease-main.vala" ease_undo_controller_set_enable_debug (ease_main_debug_undo); #line 126 "ease-main.vala" ease_main_windows = (_tmp3_ = gee_array_list_new (EASE_MAIN_TYPE_EDITOR_WINDOW_INFO, (GBoxedCopyFunc) ease_main_editor_window_info_ref, ease_main_editor_window_info_unref, NULL), _g_object_unref0 (ease_main_windows), _tmp3_); #line 129 "ease-main.vala" backend = _g_object_ref0 (clutter_get_default_backend ()); #line 130 "ease-main.vala" settings = _g_object_ref0 (gtk_settings_get_default ()); #line 131 "ease-main.vala" clutter_backend_set_double_click_time (backend, (guint) (g_object_get (settings, "gtk-double-click-time", &_tmp4_, NULL), _tmp4_)); #line 132 "ease-main.vala" clutter_backend_set_double_click_distance (backend, (guint) (g_object_get (settings, "gtk-double-click-distance", &_tmp5_, NULL), _tmp5_)); #line 487 "ease-main.c" _g_object_unref0 (settings); _g_object_unref0 (backend); } #line 137 "ease-main.vala" if (ease_main_filenames != NULL) { #line 139 "ease-main.vala" if (!running) { #line 495 "ease-main.c" { gint i; #line 141 "ease-main.vala" i = 0; #line 500 "ease-main.c" { gboolean _tmp6_; #line 141 "ease-main.vala" _tmp6_ = TRUE; #line 141 "ease-main.vala" while (TRUE) { #line 141 "ease-main.vala" if (!_tmp6_) { #line 141 "ease-main.vala" i++; #line 511 "ease-main.c" } #line 141 "ease-main.vala" _tmp6_ = FALSE; #line 141 "ease-main.vala" if (!(ease_main_filenames[i] != NULL)) { #line 141 "ease-main.vala" break; #line 519 "ease-main.c" } #line 143 "ease-main.vala" ease_main_open_file (ease_main_filenames[i]); #line 523 "ease-main.c" } } } } else { UniqueMessageData* data; #line 148 "ease-main.vala" data = unique_message_data_new (); #line 149 "ease-main.vala" unique_message_data_set_uris (data, ease_main_filenames); #line 150 "ease-main.vala" unique_app_send_message (ease_main_app, (gint) EASE_MAIN_UNIQUE_COMMAND_OPEN_FILE, data); #line 535 "ease-main.c" _unique_message_data_free0 (data); } } #line 155 "ease-main.vala" if (ease_main_play_filename != NULL) { #line 157 "ease-main.vala" if (!running) { #line 159 "ease-main.vala" ease_main_play_file (ease_main_play_filename, ease_main_filenames == NULL); #line 545 "ease-main.c" } else { UniqueMessageData* data; #line 163 "ease-main.vala" data = unique_message_data_new (); #line 164 "ease-main.vala" unique_message_data_set_filename (data, ease_main_play_filename); #line 165 "ease-main.vala" unique_app_send_message (ease_main_app, (gint) EASE_MAIN_UNIQUE_COMMAND_PLAY_FILE, data); #line 554 "ease-main.c" _unique_message_data_free0 (data); } } #line 170 "ease-main.vala" if (ease_main_filenames == NULL) { #line 170 "ease-main.vala" _tmp7_ = ease_main_play_filename == NULL; #line 562 "ease-main.c" } else { #line 170 "ease-main.vala" _tmp7_ = FALSE; #line 566 "ease-main.c" } #line 170 "ease-main.vala" if (_tmp7_) { #line 172 "ease-main.vala" if (!running) { #line 172 "ease-main.vala" ease_main_show_welcome (); #line 574 "ease-main.c" } else { #line 173 "ease-main.vala" unique_app_send_message (ease_main_app, (gint) EASE_MAIN_UNIQUE_COMMAND_SHOW_WELCOME, NULL); #line 578 "ease-main.c" } } #line 177 "ease-main.vala" if (running) { #line 583 "ease-main.c" result = 0; _g_option_context_free0 (context); #line 177 "ease-main.vala" return result; #line 588 "ease-main.c" } #line 179 "ease-main.vala" gtk_main (); #line 181 "ease-main.vala" ease_temp_clean (); #line 594 "ease-main.c" result = 0; _g_option_context_free0 (context); #line 183 "ease-main.vala" return result; #line 599 "ease-main.c" }
void totem_options_process_for_server (UniqueApp *app, const TotemCmdLineOptions* options) { GList *commands, *l; int default_action, i; commands = NULL; default_action = TOTEM_REMOTE_COMMAND_REPLACE; /* Are we quitting ? */ if (options->quit) { unique_app_send_message (app, TOTEM_REMOTE_COMMAND_QUIT, NULL); return; } /* Then handle the things that modify the playlist */ if (options->replace && options->enqueue) { /* FIXME translate that */ g_warning ("Can't enqueue and replace at the same time"); } else if (options->replace) { default_action = TOTEM_REMOTE_COMMAND_REPLACE; } else if (options->enqueue) { default_action = TOTEM_REMOTE_COMMAND_ENQUEUE; } /* Send the files to enqueue */ for (i = 0; options->filenames && options->filenames[i] != NULL; i++) { UniqueMessageData *data; char *full_path; data = unique_message_data_new (); full_path = totem_create_full_path (options->filenames[i]); unique_message_data_set_text (data, full_path ? full_path : options->filenames[i], -1); full_path = totem_create_full_path (options->filenames[i]); unique_app_send_message (app, default_action, data); /* Even if the default action is replace, we only want to replace with the first file. After that, we enqueue. */ default_action = TOTEM_REMOTE_COMMAND_ENQUEUE; unique_message_data_free (data); g_free (full_path); } if (options->playpause) { commands = g_list_append (commands, GINT_TO_POINTER (TOTEM_REMOTE_COMMAND_PLAYPAUSE)); } if (options->play) { commands = g_list_append (commands, GINT_TO_POINTER (TOTEM_REMOTE_COMMAND_PLAY)); } if (options->pause) { commands = g_list_append (commands, GINT_TO_POINTER (TOTEM_REMOTE_COMMAND_PAUSE)); } if (options->next) { commands = g_list_append (commands, GINT_TO_POINTER (TOTEM_REMOTE_COMMAND_NEXT)); } if (options->previous) { commands = g_list_append (commands, GINT_TO_POINTER (TOTEM_REMOTE_COMMAND_PREVIOUS)); } if (options->seekfwd) { commands = g_list_append (commands, GINT_TO_POINTER (TOTEM_REMOTE_COMMAND_SEEK_FORWARD)); } if (options->seekbwd) { commands = g_list_append (commands, GINT_TO_POINTER (TOTEM_REMOTE_COMMAND_SEEK_BACKWARD)); } if (options->volumeup) { commands = g_list_append (commands, GINT_TO_POINTER (TOTEM_REMOTE_COMMAND_VOLUME_UP)); } if (options->volumedown) { commands = g_list_append (commands, GINT_TO_POINTER (TOTEM_REMOTE_COMMAND_VOLUME_DOWN)); } if (options->mute) { commands = g_list_append (commands, GINT_TO_POINTER (TOTEM_REMOTE_COMMAND_MUTE)); } if (options->fullscreen) { commands = g_list_append (commands, GINT_TO_POINTER (TOTEM_REMOTE_COMMAND_FULLSCREEN)); } if (options->togglecontrols) { commands = g_list_append (commands, GINT_TO_POINTER (TOTEM_REMOTE_COMMAND_TOGGLE_CONTROLS)); } /* No commands, no files, show ourselves */ if (commands == NULL && options->filenames == NULL) { unique_app_send_message (app, TOTEM_REMOTE_COMMAND_SHOW, NULL); return; } /* Send commands */ for (l = commands; l != NULL; l = l->next) { int command = GPOINTER_TO_INT (l->data); unique_app_send_message (app, command, NULL); } g_list_free (commands); }
int start( int argc, char **argv ) { char file[PATH_MAX]; char *f = NULL; char line[7]; int lineToOpen = 0; memset(file,'\0',PATH_MAX); memset(line,'\0',7); gtk_init( &argc, &argv ); //printf("arguments::\n"); for( int i = 0; i < argc; i++ ) { //printf(" argument %d is %s\n",i,argv[i]);fflush(stdout); if( i == 1 ) { strncpy(file,argv[i],PATH_MAX); f = fileFullPath(file); } else if( i == 2 ) { strncpy(line,argv[i],6); lineToOpen = atoi(line); if( lineToOpen < 0 ) lineToOpen = 0; } } g_app = unique_app_new(EDITOR,NULL); if( unique_app_is_running (g_app) ) { char* fl = NULL; int len = 0; UniqueCommand cmd = UNIQUE_NEW; UniqueMessageData* msg = unique_message_data_new(); if( f ) len += strlen(f); if( lineToOpen ) len += strlen(line) + 1; fl = (char*)malloc(len+1); if( f ) { strcpy(fl,f); free(f); if( lineToOpen ) { strcat(fl,"@"); strcat(fl,line); } } if( len > 1 && fl ) { cmd = UNIQUE_OPEN; unique_message_data_set_text(msg,fl,len); free(fl); } unique_app_send_message(g_app,cmd,msg); unique_message_data_free(msg); } else { if(f) free(f); //g_appWin = gtk_window_new(GTK_WINDOW_TOPLEVEL); //unique_app_watch_window (app, GTK_WINDOW(g_appWin)); g_signal_connect(g_app,"message-received",G_CALLBACK(message_received_cb),NULL); MyEditorHandlerLin* meh = (MyEditorHandlerLin*)MyEditorHandlerLin::getInstance(); meh->createEditor(file,lineToOpen); gtk_main(); //gtk_widget_destroy(g_appWin); } g_object_unref (g_app); return 0; }