int main(int argc, char *argv[]) { UniqueApp *app; GtkWidget *window; GtkWidget *notebook; GError *error = NULL; bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); textdomain(GETTEXT_PACKAGE); if (gtk_init_with_args(&argc, &argv, NULL, options, GETTEXT_PACKAGE, &error) == FALSE) { if (error) { g_print("%s\n", error->message); g_error_free(error); } else g_print("An unknown error occurred\n"); return 1; } if (option_dump != FALSE) { dump_devices (); return 0; } app = unique_app_new ("org.mate.Bluetooth.properties", NULL); if (unique_app_is_running (app)) { gdk_notify_startup_complete (); unique_app_send_message (app, UNIQUE_ACTIVATE, NULL); return 0; } g_set_application_name(_("Bluetooth Properties")); gtk_window_set_default_icon_name("bluetooth"); bluetooth_plugin_manager_init (); notebook = gtk_notebook_new(); gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE); setup_adapter(GTK_NOTEBOOK(notebook)); window = create_window(notebook); g_signal_connect (app, "message-received", G_CALLBACK (message_received_cb), window); gtk_main(); bluetooth_plugin_manager_cleanup (); cleanup_adapter(); g_object_unref(app); return 0; }
/** * main: **/ int main (int argc, char *argv[]) { GOptionContext *context; GConfClient *gconf_client; GtkWidget *widget; GtkTreeSelection *selection; GtkEntryCompletion *completion; UniqueApp *unique_app; gboolean ret; guint retval; guint xid = 0; GError *error = NULL; const GOptionEntry options[] = { { "filter", 'f', 0, G_OPTION_ARG_STRING, &filter, /* TRANSLATORS: preset the GtktextBox with this filter text */ N_("Set the filter to this value"), NULL }, { "parent-window", 'p', 0, G_OPTION_ARG_INT, &xid, /* TRANSLATORS: we can make this modal (stay on top of) another window */ _("Set the parent window to make this modal"), NULL }, { NULL} }; setlocale (LC_ALL, ""); bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); if (! g_thread_supported ()) g_thread_init (NULL); g_type_init (); gtk_init (&argc, &argv); context = g_option_context_new (NULL); g_option_context_set_summary (context, _("Software Log Viewer")); g_option_context_add_main_entries (context, options, NULL); g_option_context_add_group (context, egg_debug_get_option_group ()); g_option_context_add_group (context, gtk_get_option_group (TRUE)); g_option_context_parse (context, &argc, &argv, NULL); g_option_context_free (context); /* are we running privileged */ ret = gpk_check_privileged_user (_("Log viewer"), TRUE); if (!ret) return 1; /* are we already activated? */ unique_app = unique_app_new ("org.freedesktop.PackageKit.LogViewer", NULL); if (unique_app_is_running (unique_app)) { egg_debug ("You have another instance running. This program will now close"); unique_app_send_message (unique_app, UNIQUE_ACTIVATE, NULL); goto unique_out; } g_signal_connect (unique_app, "message-received", G_CALLBACK (gpk_log_message_received_cb), NULL); /* add application specific icons to search path */ gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), GPK_DATA G_DIR_SEPARATOR_S "icons"); client = pk_client_new (); g_object_set (client, "background", FALSE, NULL); /* get UI */ builder = gtk_builder_new (); retval = gtk_builder_add_from_file (builder, GPK_DATA "/gpk-log.ui", &error); if (retval == 0) { egg_warning ("failed to load ui: %s", error->message); g_error_free (error); goto out_build; } widget = GTK_WIDGET (gtk_builder_get_object (builder, "dialog_simple")); gtk_window_set_icon_name (GTK_WINDOW (widget), GPK_ICON_SOFTWARE_LOG); /* set a size, if the screen allows */ gpk_window_set_size_request (GTK_WINDOW (widget), 900, 300); /* if command line arguments are set, then setup UI */ if (filter != NULL) { widget = GTK_WIDGET (gtk_builder_get_object (builder, "entry_package")); gtk_entry_set_text (GTK_ENTRY(widget), filter); } /* Get the main window quit */ g_signal_connect_swapped (widget, "delete_event", G_CALLBACK (gtk_main_quit), NULL); widget = GTK_WIDGET (gtk_builder_get_object (builder, "button_close")); g_signal_connect_swapped (widget, "clicked", G_CALLBACK (gtk_main_quit), NULL); gtk_widget_grab_default (widget); widget = GTK_WIDGET (gtk_builder_get_object (builder, "button_help")); g_signal_connect (widget, "clicked", G_CALLBACK (gpk_log_button_help_cb), NULL); widget = GTK_WIDGET (gtk_builder_get_object (builder, "button_refresh")); g_signal_connect (widget, "clicked", G_CALLBACK (gpk_log_button_refresh_cb), NULL); gtk_widget_hide (widget); widget = GTK_WIDGET (gtk_builder_get_object (builder, "button_filter")); g_signal_connect (widget, "clicked", G_CALLBACK (gpk_log_button_filter_cb), NULL); /* hit enter in the search box for filter */ widget = GTK_WIDGET (gtk_builder_get_object (builder, "entry_package")); g_signal_connect (widget, "activate", G_CALLBACK (gpk_log_button_filter_cb), NULL); /* autocompletion can be turned off as it's slow */ gconf_client = gconf_client_get_default (); ret = gconf_client_get_bool (gconf_client, GPK_CONF_AUTOCOMPLETE, NULL); if (ret) { /* create the completion object */ completion = gpk_package_entry_completion_new (); widget = GTK_WIDGET (gtk_builder_get_object (builder, "entry_package")); gtk_entry_set_completion (GTK_ENTRY (widget), completion); g_object_unref (completion); } else { /* use search as you type */ g_signal_connect (widget, "key-release-event", G_CALLBACK (gpk_log_entry_filter_cb), NULL); } g_object_unref (gconf_client); /* create list stores */ list_store = gtk_list_store_new (GPK_LOG_COLUMN_LAST, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN); /* create transaction_id tree view */ widget = GTK_WIDGET (gtk_builder_get_object (builder, "treeview_simple")); gtk_tree_view_set_model (GTK_TREE_VIEW (widget), GTK_TREE_MODEL (list_store)); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget)); g_signal_connect (selection, "changed", G_CALLBACK (gpk_log_treeview_clicked_cb), NULL); /* add columns to the tree view */ pk_treeview_add_general_columns (GTK_TREE_VIEW (widget)); gtk_tree_view_columns_autosize (GTK_TREE_VIEW (widget)); gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (list_store), GPK_LOG_COLUMN_TIMESPEC, GTK_SORT_DESCENDING); /* show */ widget = GTK_WIDGET (gtk_builder_get_object (builder, "dialog_simple")); gtk_widget_show (widget); /* set the parent window if it is specified */ if (xid != 0) { egg_debug ("Setting xid %i", xid); gpk_window_set_parent_xid (GTK_WINDOW (widget), xid); } /* get the update list */ gpk_log_refresh (); gtk_main (); out_build: g_object_unref (builder); g_object_unref (list_store); g_object_unref (client); g_free (transaction_id); g_free (filter); if (transactions != NULL) g_ptr_array_unref (transactions); unique_out: g_object_unref (unique_app); return 0; }
int main(int argc, char *argv[]) { UniqueApp *app; GtkStatusIcon *statusicon; GtkWidget *menu; GOptionContext *context; GError *error = NULL; bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); textdomain(GETTEXT_PACKAGE); #if !GLIB_CHECK_VERSION (2, 36, 0) g_type_init (); #endif /* Parse command-line options */ context = g_option_context_new (N_("- Bluetooth applet")); g_option_context_set_translation_domain (context, GETTEXT_PACKAGE); g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE); g_option_context_add_group (context, gtk_get_option_group (TRUE)); if (g_option_context_parse (context, &argc, &argv, &error) == FALSE) { g_print (_("%s\nRun '%s --help' to see a full list of available command line options.\n"), error->message, argv[0]); g_error_free (error); return 1; } if (option_debug == FALSE) { app = unique_app_new ("org.mate.Bluetooth.applet", NULL); if (unique_app_is_running (app)) { gdk_notify_startup_complete (); g_warning ("Applet is already running, exiting"); return 0; } } else { app = NULL; } g_set_application_name(_("Bluetooth Applet")); gtk_window_set_default_icon_name("bluetooth"); killswitch = bluetooth_killswitch_new (); g_signal_connect (G_OBJECT (killswitch), "state-changed", G_CALLBACK (killswitch_state_changed), NULL); menu = create_popupmenu(); client = bluetooth_client_new(); devices_model = bluetooth_client_get_model(client); g_signal_connect(G_OBJECT(devices_model), "row-inserted", G_CALLBACK(device_added), NULL); g_signal_connect(G_OBJECT(devices_model), "row-deleted", G_CALLBACK(device_removed), NULL); g_signal_connect (G_OBJECT (devices_model), "row-changed", G_CALLBACK (device_changed), NULL); /* Set the default adapter */ device_changed (devices_model, NULL, NULL, NULL); if (bluetooth_killswitch_has_killswitches (killswitch) != FALSE) { killswitch_state_changed (killswitch, bluetooth_killswitch_get_state (killswitch)); } /* Make sure all the unblocked adapters are powered, * so as to avoid seeing unpowered, but unblocked * devices */ bluetooth_set_adapter_powered (); settings = g_settings_new (SCHEMA_NAME); show_icon_pref = g_settings_get_boolean (settings, PREF_SHOW_ICON); g_signal_connect (G_OBJECT (settings), "changed::" PREF_SHOW_ICON, G_CALLBACK (show_icon_changed), NULL); statusicon = init_notification(); update_icon_visibility(); g_signal_connect(statusicon, "activate", G_CALLBACK(activate_callback), menu); g_signal_connect(statusicon, "popup-menu", G_CALLBACK(popup_callback), menu); setup_agents(); gtk_main(); gtk_widget_destroy(menu); g_object_unref(settings); cleanup_agents(); cleanup_notification(); g_object_unref(devices_model); g_object_unref(client); if (app != NULL) g_object_unref (app); return 0; }
/** * main: **/ int main (int argc, char *argv[]) { GOptionContext *context; guint retval = 0; GError *error = NULL; GMainLoop *loop; GtkWidget *main_window; GtkWidget *widget; UniqueApp *unique_app; guint xid = 0; McmColorimeter *colorimeter = NULL; const GOptionEntry options[] = { { "parent-window", 'p', 0, G_OPTION_ARG_INT, &xid, /* TRANSLATORS: we can make this modal (stay on top of) another window */ _("Set the parent window to make this modal"), NULL }, { NULL} }; /* setup translations */ setlocale (LC_ALL, ""); bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); /* setup LCMS */ cmsSetLogErrorHandler (mcm_picker_error_cb); context = g_option_context_new (NULL); /* TRANSLATORS: tool that is used to pick colors */ g_option_context_set_summary (context, _("MATE Color Manager Color Picker")); g_option_context_add_group (context, egg_debug_get_option_group ()); g_option_context_add_group (context, gtk_get_option_group (TRUE)); g_option_context_add_main_entries (context, options, NULL); g_option_context_parse (context, &argc, &argv, NULL); g_option_context_free (context); /* block in a loop */ loop = g_main_loop_new (NULL, FALSE); /* are we already activated? */ unique_app = unique_app_new ("org.mate.ColorManager.Picker", NULL); if (unique_app_is_running (unique_app)) { egg_debug ("You have another instance running. This program will now close"); unique_app_send_message (unique_app, UNIQUE_ACTIVATE, NULL); goto out; } g_signal_connect (unique_app, "message-received", G_CALLBACK (mcm_picker_message_received_cb), NULL); /* get UI */ builder = gtk_builder_new (); retval = gtk_builder_add_from_file (builder, MCM_DATA "/mcm-picker.ui", &error); if (retval == 0) { egg_warning ("failed to load ui: %s", error->message); g_error_free (error); goto out; } main_window = GTK_WIDGET (gtk_builder_get_object (builder, "dialog_picker")); gtk_window_set_icon_name (GTK_WINDOW (main_window), MCM_STOCK_ICON); g_signal_connect (main_window, "delete_event", G_CALLBACK (mcm_picker_delete_event_cb), loop); widget = GTK_WIDGET (gtk_builder_get_object (builder, "button_close")); g_signal_connect (widget, "clicked", G_CALLBACK (mcm_picker_close_cb), loop); widget = GTK_WIDGET (gtk_builder_get_object (builder, "button_help")); g_signal_connect (widget, "clicked", G_CALLBACK (mcm_picker_help_cb), NULL); widget = GTK_WIDGET (gtk_builder_get_object (builder, "button_measure")); g_signal_connect (widget, "clicked", G_CALLBACK (mcm_picker_measure_cb), NULL); widget = GTK_WIDGET (gtk_builder_get_object (builder, "image_preview")); gtk_widget_set_size_request (widget, 200, 200); /* add application specific icons to search path */ gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), MCM_DATA G_DIR_SEPARATOR_S "icons"); /* use the color device */ colorimeter = mcm_colorimeter_new (); g_signal_connect (colorimeter, "changed", G_CALLBACK (mcm_picker_colorimeter_changed_cb), NULL); /* set the parent window if it is specified */ if (xid != 0) { egg_debug ("Setting xid %i", xid); mcm_window_set_parent_xid (GTK_WINDOW (main_window), xid); } /* use argyll */ calibrate = MCM_CALIBRATE (mcm_calibrate_argyll_new ()); g_signal_connect (calibrate, "notify::xyz", G_CALLBACK (mcm_picker_xyz_notify_cb), NULL); /* use an info bar if there is no device, or the wrong device */ info_bar_hardware = gtk_info_bar_new (); info_bar_hardware_label = gtk_label_new (NULL); gtk_info_bar_set_message_type (GTK_INFO_BAR(info_bar_hardware), GTK_MESSAGE_INFO); widget = gtk_info_bar_get_content_area (GTK_INFO_BAR(info_bar_hardware)); gtk_container_add (GTK_CONTAINER(widget), info_bar_hardware_label); gtk_widget_show (info_bar_hardware_label); /* add infobar to devices pane */ widget = GTK_WIDGET (gtk_builder_get_object (builder, "vbox1")); gtk_box_pack_start (GTK_BOX(widget), info_bar_hardware, FALSE, FALSE, 0); /* disable some ui if no hardware */ mcm_picker_colorimeter_setup_ui (colorimeter); /* maintain a list of profiles */ profile_store = mcm_profile_store_new (); /* default to AdobeRGB */ profile_filename = "/usr/share/color/icc/Argyll/ClayRGB1998.icm"; /* setup RGB combobox */ widget = GTK_WIDGET (gtk_builder_get_object (builder, "combobox_colorspace")); mcm_prefs_set_combo_simple_text (widget); mcm_prefs_setup_space_combobox (widget); g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (mcm_prefs_space_combo_changed_cb), NULL); /* setup results expander */ mcm_picker_refresh_results (); /* setup initial preview window */ widget = GTK_WIDGET (gtk_builder_get_object (builder, "image_preview")); gtk_image_set_from_file (GTK_IMAGE (widget), DATADIR "/icons/hicolor/64x64/apps/mate-color-manager.png"); /* wait */ gtk_widget_show (main_window); g_main_loop_run (loop); out: g_object_unref (unique_app); if (profile_store != NULL) g_object_unref (profile_store); if (colorimeter != NULL) g_object_unref (colorimeter); if (calibrate != NULL) g_object_unref (calibrate); if (builder != NULL) g_object_unref (builder); g_main_loop_unref (loop); return retval; }
int main(int argc, char * argv[], char * env[]) { setlocale(LC_ALL,""); gtk_set_locale(); textdomain(GETTEXT_PACKAGE); GError * err = NULL; gchar * domain_dir=NULL; GOptionEntry args[] = { {"locale",'\0',0,G_OPTION_ARG_STRING,&domain_dir,_("set domain dir root"),N_("dir")}, {0} }; g_set_prgname(PACKAGE_NAME); if(G_UNLIKELY(!gtk_init_with_args(&argc, &argv,PACKAGE_STRING,args,PACKAGE_NAME,&err))) { g_error("%s",err->message); } if(domain_dir) { bindtextdomain(GETTEXT_PACKAGE,domain_dir); g_free(domain_dir); } g_set_application_name(_("gl2tp - GUI frontend for l2tp connection")); UniqueApp * unique = unique_app_new("net.vpn." PACKAGE_NAME,NULL); if (unique_app_is_running(unique)) { g_message("already running!"); if(UNIQUE_RESPONSE_OK != unique_app_send_message(unique,UNIQUE_ACTIVATE,NULL)) { GtkWidget * dlg = gtk_message_dialog_new(NULL,GTK_DIALOG_MODAL,GTK_MESSAGE_INFO,GTK_BUTTONS_CLOSE, _("Another one is running")); gtk_dialog_run(GTK_DIALOG(dlg)); }else { g_message("active previous one"); } return 1; } Gl2tpClient * l2client = gl2tpclient_new(); if(!gl2tpclient_bind(l2client)) { GtkWidget * dlg = gtk_message_dialog_new(NULL,GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_CLOSE, _("unable to bind to local port 1701? Another one running?")); gtk_dialog_run(GTK_DIALOG(dlg)); g_error(_("unable to bind to local port 1701? Another one running?")); } GdkPixbuf * pixbuf = gdk_pixbuf_new_from_inline(-1,gl2tp_icon,FALSE,NULL); GtkWidget * main = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_signal_connect(unique,"message-received",G_CALLBACK(active_instance),main); gtk_window_set_icon(GTK_WINDOW(main),pixbuf); GtkWidget * box = gtk_vbox_new(FALSE,TRUE); gtk_container_add(GTK_CONTAINER(main),box); g_signal_connect(G_OBJECT (main), "destroy", G_CALLBACK(gtk_main_quit), NULL); GtkWidget * gl2tp = gl2tp_new(); gtk_box_pack_start(GTK_BOX(box),gl2tp,TRUE,TRUE,FALSE); status = gtk_statusbar_new(); guint id = gtk_statusbar_get_context_id(GTK_STATUSBAR(status),"status"); gtk_box_pack_end(GTK_BOX(box),status,FALSE,TRUE,TRUE); gtk_statusbar_push(GTK_STATUSBAR(status),id,_("Ready")); g_signal_connect(gl2tp,"status-changed",G_CALLBACK(show_status),GUINT_TO_POINTER(id)); g_signal_connect(gl2tp,"status-restore",G_CALLBACK(pop_status),GUINT_TO_POINTER(id)); g_idle_add(gl2tp_load_config,gl2tp); gtk_widget_show_all(main); gtk_main(); return 0; }
/** * main: **/ int main (int argc, char *argv[]) { gboolean program_version = FALSE; GOptionContext *context; GtkWidget *main_window; GtkWidget *widget; PkControl *control; UniqueApp *unique_app; guint retval; guint xid = 0; GError *error = NULL; GMainLoop *loop; const GOptionEntry options[] = { { "version", '\0', 0, G_OPTION_ARG_NONE, &program_version, _("Show the program version and exit"), NULL }, { "parent-window", 'p', 0, G_OPTION_ARG_INT, &xid, /* TRANSLATORS: we can make this modal (stay on top of) another window */ _("Set the parent window to make this modal"), NULL }, { NULL} }; setlocale (LC_ALL, ""); bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); if (! g_thread_supported ()) g_thread_init (NULL); dbus_g_thread_init (); g_type_init (); gtk_init (&argc, &argv); context = g_option_context_new (NULL); /* TRANSLATORS: program name, an application to set per-user policy for updates */ g_option_context_set_summary(context, _("Software Update Preferences")); g_option_context_add_main_entries (context, options, NULL); g_option_context_add_group (context, egg_debug_get_option_group ()); g_option_context_add_group (context, gtk_get_option_group (TRUE)); g_option_context_parse (context, &argc, &argv, NULL); g_option_context_free (context); if (program_version) { g_print (VERSION "\n"); return 0; } /* are we already activated? */ unique_app = unique_app_new ("org.freedesktop.PackageKit.Prefs", NULL); if (unique_app_is_running (unique_app)) { egg_debug ("You have another instance running. This program will now close"); unique_app_send_message (unique_app, UNIQUE_ACTIVATE, NULL); goto unique_out; } g_signal_connect (unique_app, "message-received", G_CALLBACK (gpk_prefs_message_received_cb), NULL); /* get actions */ loop = g_main_loop_new (NULL, FALSE); control = pk_control_new (); g_signal_connect (control, "notify::network-state", G_CALLBACK (gpk_prefs_notify_network_state_cb), NULL); /* get UI */ builder = gtk_builder_new (); retval = gtk_builder_add_from_file (builder, GPK_DATA "/gpk-prefs.ui", &error); if (retval == 0) { egg_warning ("failed to load ui: %s", error->message); g_error_free (error); goto out_build; } main_window = GTK_WIDGET (gtk_builder_get_object (builder, "dialog_prefs")); /* Hide window first so that the dialogue resizes itself without redrawing */ gtk_widget_hide (main_window); gtk_window_set_icon_name (GTK_WINDOW (main_window), GPK_ICON_SOFTWARE_UPDATE_PREFS); g_signal_connect (main_window, "delete_event", G_CALLBACK (gpk_prefs_delete_event_cb), loop); widget = GTK_WIDGET (gtk_builder_get_object (builder, "checkbutton_mobile_broadband")); gpk_prefs_notify_checkbutton_setup (widget, GPK_CONF_CONNECTION_USE_MOBILE); widget = GTK_WIDGET (gtk_builder_get_object (builder, "button_close")); g_signal_connect (widget, "clicked", G_CALLBACK (gpk_prefs_close_cb), loop); widget = GTK_WIDGET (gtk_builder_get_object (builder, "button_help")); g_signal_connect (widget, "clicked", G_CALLBACK (gpk_prefs_help_cb), NULL); /* update the combo boxes */ gpk_prefs_update_freq_combo_setup (); gpk_prefs_upgrade_freq_combo_setup (); gpk_prefs_auto_update_combo_setup (); gtk_widget_show (main_window); /* set the parent window if it is specified */ if (xid != 0) { egg_debug ("Setting xid %i", xid); gpk_window_set_parent_xid (GTK_WINDOW (main_window), xid); } /* get some data */ pk_control_get_properties_async (control, NULL, (GAsyncReadyCallback) gpk_prefs_get_properties_cb, loop); /* wait */ g_main_loop_run (loop); out_build: g_main_loop_unref (loop); g_object_unref (control); g_object_unref (builder); unique_out: g_object_unref (unique_app); 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" }
/** * main: **/ int main (int argc, char *argv[]) { gboolean program_version = FALSE; gboolean timed_exit = FALSE; GpkCheckUpdate *cupdate = NULL; GpkWatch *watch = NULL; GpkFirmware *firmware = NULL; GpkHardware *hardware = NULL; GOptionContext *context; UniqueApp *unique_app; gboolean ret; const GOptionEntry options[] = { { "timed-exit", '\0', 0, G_OPTION_ARG_NONE, &timed_exit, _("Exit after a small delay"), NULL }, { "version", '\0', 0, G_OPTION_ARG_NONE, &program_version, _("Show the program version and exit"), NULL }, { NULL} }; setlocale (LC_ALL, ""); bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); if (! g_thread_supported ()) g_thread_init (NULL); g_type_init (); gtk_init (&argc, &argv); dbus_g_thread_init (); notify_init ("gpk-update-icon"); /* TRANSLATORS: program name, a session wide daemon to watch for updates and changing system state */ g_set_application_name (_("Update Applet")); context = g_option_context_new (NULL); g_option_context_set_summary (context, _("Update Applet")); g_option_context_add_main_entries (context, options, NULL); g_option_context_add_group (context, egg_debug_get_option_group ()); g_option_context_add_group (context, gtk_get_option_group (TRUE)); g_option_context_parse (context, &argc, &argv, NULL); g_option_context_free (context); if (program_version) { g_print (VERSION "\n"); return 0; } /* TRANSLATORS: title to pass to to the user if there are not enough privs */ ret = gpk_check_privileged_user (_("Update applet"), FALSE); if (!ret) { egg_warning ("Exit: gpk_check_privileged_user returned FALSE"); return 1; } /* are we already activated? */ unique_app = unique_app_new ("org.freedesktop.PackageKit.UpdateIcon", NULL); if (unique_app_is_running (unique_app)) { egg_debug ("You have another instance running. This program will now close"); unique_app_send_message (unique_app, UNIQUE_ACTIVATE, NULL); goto unique_out; } /* add application specific icons to search path */ gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), GPK_DATA G_DIR_SEPARATOR_S "icons"); /* create new objects */ cupdate = gpk_check_update_new (); watch = gpk_watch_new (); firmware = gpk_firmware_new (); hardware = gpk_hardware_new (); /* Only timeout if we have specified iton the command line */ if (timed_exit) g_timeout_add_seconds (120, (GSourceFunc) gtk_main_quit, NULL); /* wait */ gtk_main (); g_object_unref (cupdate); g_object_unref (watch); g_object_unref (firmware); g_object_unref (hardware); unique_out: g_object_unref (unique_app); return 0; }
int main(int argc, char** argv) { int status = 0; mate_gettext(GETTEXT_PACKAGE, LOCALE_DIR, "UTF-8"); #if !GLIB_CHECK_VERSION (2, 36, 0) g_type_init(); #endif /* http://www.gtk.org/api/2.6/glib/glib-Commandline-option-parser.html */ GOptionContext* context = g_option_context_new(NULL); g_option_context_add_main_entries(context, command_entries, GETTEXT_PACKAGE); g_option_context_add_group(context, gtk_get_option_group(TRUE)); g_option_context_parse(context, &argc, &argv, NULL); /* Not necesary at all, program just run and die. * But it free a little memory. */ g_option_context_free(context); if (mate_about_nogui == TRUE) { printf("%s %s\n", gettext(program_name), version); } else { gtk_init(&argc, &argv); /** * Examples taken from: * http://developer.gnome.org/gtk3/3.0/gtk-migrating-GtkApplication.html */ #ifdef USE_UNIQUE mate_about_application = unique_app_new("org.mate.about", NULL); if (unique_app_is_running(mate_about_application)) { UniqueResponse response = unique_app_send_message(mate_about_application, UNIQUE_ACTIVATE, NULL); if (response != UNIQUE_RESPONSE_OK) { status = 1; } } else { mate_about_run(); } #elif GTK_CHECK_VERSION(3, 0, 0) && !defined(USE_UNIQUE) mate_about_application = gtk_application_new("org.mate.about", 0); g_signal_connect(mate_about_application, "activate", G_CALLBACK(mate_about_on_activate), NULL); status = g_application_run(G_APPLICATION(mate_about_application), argc, argv); g_object_unref(mate_about_application); #elif GLIB_CHECK_VERSION(2, 26, 0) && !defined(USE_UNIQUE) mate_about_application = g_application_new("org.mate.about", G_APPLICATION_FLAGS_NONE); g_signal_connect(mate_about_application, "activate", G_CALLBACK(mate_about_on_activate), NULL); status = g_application_run(G_APPLICATION(mate_about_application), argc, argv); g_object_unref(mate_about_application); #else mate_about_run(); #endif } return status; }
int main(int argc, char* argv[]) { gboolean hidden = FALSE; UniqueApp* unique_app; AppShellData* app_data; GSList* actions; GError* error; GOptionEntry options[] = { {"hide", 0, 0, G_OPTION_ARG_NONE, &hidden, N_("Hide on start (useful to preload the shell)"), NULL}, {NULL} }; #ifdef ENABLE_NLS bindtextdomain(GETTEXT_PACKAGE, MATELOCALEDIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); textdomain(GETTEXT_PACKAGE); #endif error = NULL; if (!gtk_init_with_args(&argc, &argv, NULL, options, GETTEXT_PACKAGE, &error)) { g_printerr("%s\n", error->message); g_error_free(error); return 1; } unique_app = unique_app_new("org.mate.mate-control-center.shell", NULL); if (unique_app_is_running(unique_app)) { int retval = 0; if (!hidden) { UniqueResponse response; response = unique_app_send_message(unique_app, UNIQUE_ACTIVATE, NULL); retval = (response != UNIQUE_RESPONSE_OK); } g_object_unref(unique_app); return retval; } app_data = appshelldata_new("matecc.menu", GTK_ICON_SIZE_DND, FALSE, TRUE, 0); generate_categories(app_data); actions = get_actions_list(); layout_shell(app_data, _("Filter"), _("Groups"), _("Common Tasks"), actions, handle_static_action_clicked); create_main_window(app_data, "MyControlCenter", _("Control Center"), "preferences-desktop", 975, 600, hidden); unique_app_watch_window(unique_app, GTK_WINDOW(app_data->main_app)); g_signal_connect(unique_app, "message-received", G_CALLBACK(message_received_cb), app_data); gtk_main(); g_object_unref(unique_app); return 0; }
/** * main: **/ int main (int argc, char *argv[]) { gboolean program_version = FALSE; GpkUpdateViewer *update_viewer = NULL; GOptionContext *context; UniqueApp *unique_app; gboolean ret; const GOptionEntry options[] = { { "version", '\0', 0, G_OPTION_ARG_NONE, &program_version, /* TRANSLATORS: show the program version */ _("Show the program version and exit"), NULL }, { NULL} }; setlocale (LC_ALL, ""); bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); if (! g_thread_supported ()) g_thread_init (NULL); dbus_g_thread_init (); g_type_init (); gtk_init (&argc, &argv); context = g_option_context_new (NULL); g_option_context_set_summary (context, _("Add/Remove Software")); g_option_context_add_main_entries (context, options, NULL); g_option_context_add_group (context, egg_debug_get_option_group ()); g_option_context_add_group (context, gtk_get_option_group (TRUE)); g_option_context_parse (context, &argc, &argv, NULL); g_option_context_free (context); if (program_version) { g_print (VERSION "\n"); return 0; } /* add application specific icons to search path */ gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), GPK_DATA G_DIR_SEPARATOR_S "icons"); /* TRANSLATORS: title to pass to to the user if there are not enough privs */ ret = gpk_check_privileged_user (_("Software Update Viewer"), TRUE); if (!ret) return 1; /* are we already activated? */ unique_app = unique_app_new ("org.freedesktop.PackageKit.UpdateViewer", NULL); if (unique_app_is_running (unique_app)) { egg_debug ("You have another instance running. This program will now close"); unique_app_send_message (unique_app, UNIQUE_ACTIVATE, NULL); goto unique_out; } /* create a new update_viewer object */ update_viewer = gpk_update_viewer_new (); g_signal_connect (unique_app, "message-received", G_CALLBACK (gpk_update_viewer_message_received_cb), update_viewer); g_signal_connect (update_viewer, "action-close", G_CALLBACK (gpk_update_viewer_close_cb), NULL); /* wait */ gtk_main (); g_object_unref (update_viewer); unique_out: g_object_unref (unique_app); return 0; }
int main (int argc, char *argv[]) { TpAccountManager *account_manager; GError *error = NULL; UniqueApp *unique_app; GOptionContext *optcontext; GOptionEntry options[] = { { "hidden", 'h', 0, G_OPTION_ARG_NONE, &hidden, N_("Don't display any dialogs; do any work (eg, importing) and exit"), NULL }, { "if-needed", 'n', 0, G_OPTION_ARG_NONE, &only_if_needed, N_("Don't display any dialogs if there are any non-salut accounts"), NULL }, { "select-account", 's', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING, &selected_account_name, N_("Initially select given account (eg, " "gabble/jabber/foo_40example_2eorg0)"), N_("<account-id>") }, { NULL } }; g_thread_init (NULL); empathy_init (); optcontext = g_option_context_new (N_("- Empathy Accounts")); g_option_context_add_group (optcontext, gtk_get_option_group (TRUE)); g_option_context_add_main_entries (optcontext, options, GETTEXT_PACKAGE); if (!g_option_context_parse (optcontext, &argc, &argv, &error)) { g_print ("%s\nRun '%s --help' to see a full list of available command line options.\n", error->message, argv[0]); g_warning ("Error in empathy init: %s", error->message); return EXIT_FAILURE; } g_option_context_free (optcontext); empathy_gtk_init (); g_set_application_name (_("Empathy Accounts")); gtk_window_set_default_icon_name ("empathy"); textdomain (GETTEXT_PACKAGE); unique_app = unique_app_new (EMPATHY_ACCOUNTS_DBUS_NAME, NULL); if (unique_app_is_running (unique_app)) { unique_app_send_message (unique_app, UNIQUE_ACTIVATE, NULL); g_object_unref (unique_app); return EXIT_SUCCESS; } account_manager = tp_account_manager_dup (); tp_account_manager_prepare_async (account_manager, NULL, account_manager_ready_for_accounts_cb, selected_account_name); g_signal_connect (unique_app, "message-received", G_CALLBACK (unique_app_message_cb), NULL); gtk_main (); g_object_unref (account_manager); g_object_unref (unique_app); return EXIT_SUCCESS; }
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; }