/** * e_shell_utils_import_uris: * @shell: The #EShell instance * @uris: %NULL-terminated list of URIs to import * * Imports given URIs to Evolution, giving user a choice what to import * if more than one importer can be applied, and where to import it, if * the importer itself is configurable. * * URIs should be either a filename or URI of form file://. * All others are skipped. * * Returns: the number of URIs successfully handled **/ guint e_shell_utils_import_uris (EShell *shell, const gchar * const *uris) { GtkWindow *parent; GtkWidget *assistant; g_return_val_if_fail (shell != NULL, 0); g_return_val_if_fail (uris != NULL, 0); parent = e_shell_get_active_window (shell); assistant = e_import_assistant_new_simple (parent, uris); if (assistant) { g_signal_connect_after ( assistant, "cancel", G_CALLBACK (gtk_widget_destroy), NULL); g_signal_connect_after ( assistant, "finished", G_CALLBACK (gtk_widget_destroy), NULL); gtk_application_add_window ( GTK_APPLICATION (shell), GTK_WINDOW (assistant)); gtk_widget_show (assistant); } else g_warning ("Cannot import any of the given URIs"); return g_strv_length ((gchar **) uris); }
static void activate (GtkApplication *app) { GList *list; GSList* actions; gboolean hidden = FALSE; list = gtk_application_get_windows (app); AppShellData* 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); if (list) { gtk_window_present (GTK_WINDOW (list->data)); } else { create_main_window(app_data, "MyControlCenter", _("Control Center"), "preferences-desktop", 975, 600, hidden); gtk_application_add_window (app, GTK_WINDOW(app_data->main_app)); } }
static NemoWindow * create_window (NemoApplication *application, GdkScreen *screen) { NemoWindow *window; g_return_val_if_fail (NEMO_IS_APPLICATION (application), NULL); window = g_object_new (NEMO_TYPE_WINDOW, "screen", screen, NULL); g_signal_connect_data (window, "delete_event", G_CALLBACK (nemo_window_delete_event_callback), NULL, NULL, G_CONNECT_AFTER); gtk_application_add_window (GTK_APPLICATION (application), GTK_WINDOW (window)); /* Do not yet show the window. It will be shown later on if it can * successfully display its initial URI. Otherwise it will be destroyed * without ever having seen the light of day. */ return window; }
static void photos_main_window_constructed (GObject *object) { PhotosMainWindow *self = PHOTOS_MAIN_WINDOW (object); GApplication *app; G_OBJECT_CLASS (photos_main_window_parent_class)->constructed (object); /* HACK: Since GtkWindow:application is a non-construct property it * will be set after constructed has finished. We explicitly add * the window to the application here before creating the rest of * the widget hierarchy. This ensures that we can use * photos_application_get_scale_factor while constructing the * widgets. */ app = g_application_get_default (); gtk_application_add_window (GTK_APPLICATION (app), GTK_WINDOW (self)); self->edit_cancel = g_action_map_lookup_action (G_ACTION_MAP (app), "edit-cancel"); self->import_cancel = g_action_map_lookup_action (G_ACTION_MAP (app), "import-cancel"); self->load_next = g_action_map_lookup_action (G_ACTION_MAP (app), "load-next"); self->load_previous = g_action_map_lookup_action (G_ACTION_MAP (app), "load-previous"); gtk_widget_init_template (GTK_WIDGET (self)); }
static void on_activate(GApplication *gapp) { gtk_application_add_window(app, GTK_WINDOW(window)); gtk_widget_show_all(window); gtk_window_present(GTK_WINDOW(window)); }
static void create_new_desktop_window (NemoDesktopManager *manager, gint monitor, gboolean primary, gboolean show_desktop) { GtkWidget *window; DesktopInfo *info = g_slice_new0 (DesktopInfo); info->monitor_num = monitor; info->shows_desktop = show_desktop; info->is_primary = primary; if (show_desktop) { window = GTK_WIDGET (nemo_desktop_window_new (monitor)); } else { window = GTK_WIDGET (nemo_blank_desktop_window_new (monitor)); } info->window = window; /* We realize it immediately so that the NEMO_DESKTOP_WINDOW_ID property is set so gnome-settings-daemon doesn't try to set the background. And we do a gdk_flush() to be sure X gets it. */ gtk_widget_realize (GTK_WIDGET (window)); gdk_flush (); gtk_application_add_window (GTK_APPLICATION (nemo_application_get_singleton ()), GTK_WINDOW (window)); manager->desktops = g_list_append (manager->desktops, info); }
static void create_new_desktop_window (NemoDesktopManager *manager, gint monitor, gboolean primary, gboolean show_desktop) { FETCH_PRIV (manager); GtkWidget *window; DesktopInfo *info = g_slice_new0 (DesktopInfo); info->monitor_num = monitor; info->shows_desktop = show_desktop; info->is_primary = primary; if (show_desktop) { window = GTK_WIDGET (nemo_desktop_window_new (monitor)); } else { window = GTK_WIDGET (nemo_blank_desktop_window_new (monitor)); } info->window = window; if (priv->scale_factor_changed_id == 0) { priv->scale_factor_changed_id = g_signal_connect (window, "notify::scale-factor", G_CALLBACK (on_window_scale_changed), manager); } gtk_application_add_window (GTK_APPLICATION (nemo_application_get_singleton ()), GTK_WINDOW (window)); priv->desktops = g_list_append (priv->desktops, info); }
// Note that this is called a few times. If command line arguments are // given, then it is called from the open. It can also be called from // g_application_run. static void activateApp(GApplication *gapp) { GtkApplication *app = GTK_APPLICATION (gapp); GtkWidget *window = Gui::getMainWindow(); gEditor->loadSettings(); gtk_widget_show_all(window); gtk_application_add_window(app, GTK_WINDOW(window)); }
static void new_window_action(GSimpleAction* action, GVariant* parameter, gpointer user_data) { RefImplApp* app = REFIMPL_APP(user_data); GtkWidget* window; window = refimpl_window_new(app); gtk_application_add_window(GTK_APPLICATION(app), GTK_WINDOW(window)); gtk_widget_show_all(window); }
static GtkWidget * ag_app_create_window(AgApp *app) { GtkWidget *window; window = ag_window_new(app); gtk_application_add_window(GTK_APPLICATION(app), GTK_WINDOW(window)); gtk_widget_show_all(window); return window; }
static void activate (GApplication *app) { GtkBuilder *builder; GtkWindow *window; GtkWidget *widget; GtkTreeModel *model; GtkTreeIter iter; GError *error = NULL; static GActionEntry win_entries[] = { { "run", activate_run, NULL, NULL, NULL } }; builder = gtk_builder_new (); gtk_builder_add_from_resource (builder, "/ui/main.ui", &error); if (error != NULL) { g_critical ("%s", error->message); exit (1); } window = (GtkWindow *)gtk_builder_get_object (builder, "window"); gtk_application_add_window (GTK_APPLICATION (app), window); g_action_map_add_action_entries (G_ACTION_MAP (window), win_entries, G_N_ELEMENTS (win_entries), window); notebook = (GtkWidget *)gtk_builder_get_object (builder, "notebook"); info_view = (GtkWidget *)gtk_builder_get_object (builder, "info-textview"); source_view = (GtkWidget *)gtk_builder_get_object (builder, "source-textview"); headerbar = (GtkWidget *)gtk_builder_get_object (builder, "headerbar"); treeview = (GtkWidget *)gtk_builder_get_object (builder, "treeview"); model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview)); load_file (gtk_demos[0].name, gtk_demos[0].filename); populate_model (model); g_signal_connect (treeview, "row-activated", G_CALLBACK (row_activated_cb), model); widget = (GtkWidget *)gtk_builder_get_object (builder, "treeview-selection"); g_signal_connect (widget, "changed", G_CALLBACK (selection_cb), model); gtk_tree_model_get_iter_first (gtk_tree_view_get_model (GTK_TREE_VIEW (treeview)), &iter); gtk_tree_selection_select_iter (GTK_TREE_SELECTION (widget), &iter); gtk_tree_view_collapse_all (GTK_TREE_VIEW (treeview)); gtk_widget_show_all (GTK_WIDGET (window)); g_object_unref (builder); }
static void fcitx_config_wizard_app_activate(GApplication *application) { GList* list = gtk_application_get_windows(GTK_APPLICATION(application)); if (list) { gtk_window_present(GTK_WINDOW(list->data)); } else { GtkWidget *window; window = create_assistant(); gtk_application_add_window(GTK_APPLICATION(application), GTK_WINDOW(window)); gtk_widget_show_all(GTK_WIDGET(window)); } }
static void activate(GtkApplication *app, gpointer user_data) { GUI* gptr = (GUI*) user_data; Window* w = gptr->get_window(); w->builder = gtk_builder_new_from_file ("builder.ui"); w->save_button = GTK_WIDGET(gtk_builder_get_object(w->builder, "button_save")); w->window = GTK_WIDGET(gtk_builder_get_object(w->builder, "window")); w->drawing_area_fract = GTK_WIDGET(gtk_builder_get_object(w->builder, "drawingarea_fract")); w->left_entry = GTK_WIDGET(gtk_builder_get_object(w->builder, "entry1")); w->right_entry = GTK_WIDGET(gtk_builder_get_object(w->builder, "entry2")); w->up_entry = GTK_WIDGET(gtk_builder_get_object(w->builder, "entry3")); w->down_entry = GTK_WIDGET(gtk_builder_get_object(w->builder, "entry4")); w->width_entry = GTK_WIDGET(gtk_builder_get_object(w->builder, "entry5")); w->height_entry = GTK_WIDGET(gtk_builder_get_object(w->builder, "entry6")); w->render_button = GTK_WIDGET(gtk_builder_get_object(w->builder, "button_render")); w->combobox = GTK_WIDGET(gtk_builder_get_object(w->builder, "combobox")); gtk_entry_set_text((GtkEntry*)w->left_entry, "-1.0"); gtk_entry_set_text((GtkEntry*)w->right_entry, "1.0"); gtk_entry_set_text((GtkEntry*)w->up_entry, "1.0"); gtk_entry_set_text((GtkEntry*)w->down_entry, "-1.0"); gtk_entry_set_text((GtkEntry*)w->width_entry, "800"); gtk_entry_set_text((GtkEntry*)w->height_entry, "600"); for(int i = 0; i < gptr->get_rs_count(); ++i) { gtk_combo_box_text_append_text ( (GtkComboBoxText*)w->combobox, gptr->get_rs()[i].get_id().c_str()); } gtk_combo_box_set_active((GtkComboBox*)w->combobox, 0); gdk_window_set_events( gtk_widget_get_window(w->drawing_area_fract), GDK_ALL_EVENTS_MASK); g_signal_connect (w->drawing_area_fract, "draw", G_CALLBACK(draw_callback), gptr); g_signal_connect (w->drawing_area_fract, "size-allocate", G_CALLBACK(da_allocate_callback), gptr); g_signal_connect (w->render_button, "clicked", G_CALLBACK(parse_args_callback), gptr); g_signal_connect (w->drawing_area_fract, "button-press-event", G_CALLBACK(button_press_callback), gptr); g_signal_connect (w->drawing_area_fract, "button-release-event", G_CALLBACK(button_release_callback), gptr); g_signal_connect (w->save_button, "clicked", G_CALLBACK (save_file), gptr); gptr->render(); gtk_application_add_window(app, GTK_WINDOW(w->window)); }
NemoWindow * nemo_application_create_window (NemoApplication *application, GdkScreen *screen) { NemoWindow *window; char *geometry_string; gboolean maximized; g_return_val_if_fail (NEMO_IS_APPLICATION (application), NULL); window = nemo_window_new (screen); gtk_application_add_window (GTK_APPLICATION (application), GTK_WINDOW (window)); maximized = g_settings_get_boolean (nemo_window_state, NEMO_WINDOW_STATE_MAXIMIZED); if (maximized) { gtk_window_maximize (GTK_WINDOW (window)); } else { gtk_window_unmaximize (GTK_WINDOW (window)); } geometry_string = g_settings_get_string (nemo_window_state, NEMO_WINDOW_STATE_GEOMETRY); if (geometry_string != NULL && geometry_string[0] != 0) { /* Ignore saved window position if a window with the same * location is already showing. That way the two windows * wont appear at the exact same location on the screen. */ eel_gtk_window_set_initial_geometry_from_string (GTK_WINDOW (window), geometry_string, NEMO_WINDOW_MIN_WIDTH, NEMO_WINDOW_MIN_HEIGHT, TRUE); } g_free (geometry_string); DEBUG ("Creating a new navigation window"); return window; }
static void on_activate (GtkApplication *app, NimfSettings *nsettings) { const GList *window_list; window_list = gtk_application_get_windows (app); if (window_list) { gtk_window_present (GTK_WINDOW (window_list->data)); return; } nimf_settings_window = nimf_settings_build_main_window (nsettings); gtk_application_add_window (GTK_APPLICATION (nsettings->app), GTK_WINDOW (nimf_settings_window)); gtk_widget_show_all (nimf_settings_window); }
static void nemo_application_create_desktop_windows (NemoApplication *application) { GdkDisplay *display; NemoDesktopWindow *window; GtkWidget *selection_widget; int screens, i; display = gdk_display_get_default (); screens = gdk_display_get_n_screens (display); for (i = 0; i < screens; i++) { DEBUG ("Creating a desktop window for screen %d", i); selection_widget = get_desktop_manager_selection (display, i); if (selection_widget != NULL) { window = nemo_desktop_window_new (gdk_display_get_screen (display, i)); g_signal_connect (selection_widget, "selection_clear_event", G_CALLBACK (selection_clear_event_cb), window); g_signal_connect (window, "unrealize", G_CALLBACK (desktop_unrealize_cb), selection_widget); /* We realize it immediately so that the NEMO_DESKTOP_WINDOW_ID property is set so gnome-settings-daemon doesn't try to set the background. And we do a gdk_flush() to be sure X gets it. */ gtk_widget_realize (GTK_WIDGET (window)); gdk_flush (); nemo_application_desktop_windows = g_list_prepend (nemo_application_desktop_windows, window); gtk_application_add_window (GTK_APPLICATION (application), GTK_WINDOW (window)); } } }
static void ch_assemble_startup_cb (GApplication *application, ChAssemblePrivate *priv) { g_autoptr(GError) error = NULL; gint retval; GtkWidget *box; GtkWidget *main_window; /* get UI */ priv->builder = gtk_builder_new (); retval = gtk_builder_add_from_file (priv->builder, CH_DATA "/ch-assemble.ui", &error); if (retval == 0) { g_warning ("failed to load ui: %s", error->message); return; } /* add application specific icons to search path */ gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), CH_DATA G_DIR_SEPARATOR_S "icons"); main_window = GTK_WIDGET (gtk_builder_get_object (priv->builder, "window_assemble")); gtk_application_add_window (priv->application, GTK_WINDOW (main_window)); gtk_widget_set_size_request (main_window, 600, 400); /* Set initial state */ box = GTK_WIDGET (gtk_builder_get_object (priv->builder, "box1")); gtk_box_pack_start (GTK_BOX (box), GTK_WIDGET (priv->sample_widget), TRUE, TRUE, 0); ch_assemble_set_label (priv, _("No device detected")); ch_assemble_set_color (priv, 0.5f, 0.5f, 0.5f); /* is the colorhug already plugged in? */ g_usb_context_enumerate (priv->usb_ctx); /* show main UI */ gtk_window_maximize (GTK_WINDOW (main_window)); gtk_widget_show (main_window); }
static void photos_main_window_constructed (GObject *object) { PhotosMainWindow *self = PHOTOS_MAIN_WINDOW (object); PhotosMainWindowPrivate *priv = self->priv; GApplication *app; G_OBJECT_CLASS (photos_main_window_parent_class)->constructed (object); /* HACK: Since GtkWindow:application is a non-construct property it * will be set after constructed has finished. We explicitly add * the window to the application here before creating the rest of * the widget hierarchy. This ensures that we can use * photos_application_get_scale_factor while constructing the * widgets. */ app = g_application_get_default (); gtk_application_add_window (GTK_APPLICATION (app), GTK_WINDOW (self)); priv->embed = photos_embed_new (); gtk_container_add (GTK_CONTAINER (self), priv->embed); }
void startup(GApplication *app, gpointer user_data) { GtkMenu *tray_menu; GtkWindow *window; gchar *theme_path; /* set ui */ builder = gtk_builder_new(); gtk_builder_add_from_resource(builder, "/ui/calendar.glade", NULL); gtk_builder_connect_signals(builder, NULL); window = GTK_WINDOW(gtk_builder_get_object(builder, "window")); tray_menu = GTK_MENU(gtk_builder_get_object(builder, "tray_menu")); /* set gtkapplication window */ gtk_application_add_window(GTK_APPLICATION(app), window); /* initialize our time */ time_gen(); mytime = today; /* prepare appindicator */ theme_path = g_build_filename(DATADIR, "icons", "hicolor", "256x256", NULL); indicator = app_indicator_new_with_path("Acal", "persian-calendar-1", APP_INDICATOR_CATEGORY_APPLICATION_STATUS, theme_path); app_indicator_set_status(indicator, APP_INDICATOR_STATUS_ACTIVE); app_indicator_set_menu(indicator, tray_menu); /* show initial tray & prepare cal */ update_tray(); cal_gen(); /* add timer to update tray */ g_timeout_add_seconds(3, check_update_tray, (gpointer)indicator); }
static void activate (GApplication *app) { GtkBuilder *builder; GtkWindow *window; GtkWidget *widget; GtkAdjustment *adj; static GActionEntry win_entries[] = { { "dark", activate_toggle, NULL, "false", change_theme_state } }; builder = gtk_builder_new (); gtk_builder_add_from_resource (builder, "/ui/widget-factory.ui", NULL); window = (GtkWindow *)gtk_builder_get_object (builder, "window"); gtk_application_add_window (GTK_APPLICATION (app), window); g_action_map_add_action_entries (G_ACTION_MAP (window), win_entries, G_N_ELEMENTS (win_entries), window); widget = (GtkWidget *)gtk_builder_get_object (builder, "progressbar3"); pulse_id = g_timeout_add (250, (GSourceFunc)pulse_it, widget); g_signal_connect (gtk_builder_get_object (builder, "adjustment1"), "value-changed", G_CALLBACK (update_pulse_time), widget); widget = (GtkWidget *)gtk_builder_get_object (builder, "page2dismiss"); g_signal_connect (widget, "clicked", G_CALLBACK (dismiss), NULL); widget = (GtkWidget *)gtk_builder_get_object (builder, "page2note"); adj = (GtkAdjustment *) gtk_builder_get_object (builder, "adjustment2"); g_signal_connect (adj, "value-changed", G_CALLBACK (spin_value_changed), widget); gtk_widget_show_all (GTK_WIDGET (window)); g_object_unref (builder); }
int main(int argc, char *args[]) { GtkApplication *application = gtk_application_new(NULL, 0); g_application_register(G_APPLICATION(application), NULL, NULL); struct capplication_handler *application_handler = alloc_application_handler(application); // Handle option context. GOptionEntry option_entries[] = { { "version", 'v', 0, G_OPTION_ARG_NONE, &application_handler->version, "Show the version of the program.", NULL }, { G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &application_handler->file_name, "A file containing a matrix for sequence alignment.", NULL }, { "help", 'h', 0, G_OPTION_ARG_NONE, &application_handler->help, "Show this help description.", NULL }, {NULL} }; g_option_context_add_main_entries(application_handler->option_context, option_entries, _PROGRAM_NAME_); g_option_context_set_help_enabled(application_handler->option_context, TRUE); g_option_context_set_ignore_unknown_options(application_handler->option_context, TRUE); // Parse options. GError *error = NULL; gboolean context_result = FALSE; context_result = g_option_context_parse(application_handler->option_context, &argc, &args, &error); if (context_result) { if (application_handler->version) { g_printf("%s version %s.\n", _PROGRAM_NAME_, _PROGRAM_VERSION_); g_printf("Copyright © %s %s. All rights reserved.\n", _PROGRAM_YEAR_, _PROGRAM_AUTHOR_); } } else if (error) { printf("EE Failed to parser arguments.\n"); } g_option_context_free(application_handler->option_context); struct cwindow_handler *window_handler = alloc_window_handler(application_handler); if (gtk_application_prefers_app_menu(GTK_APPLICATION(application_handler->application))) { //gtk_application_set_app_menu(GTK_APPLICATION(application_handler->application), G_MENU_MODEL(window_handler->menu_model)); } gtk_application_add_window(GTK_APPLICATION(application_handler->application), GTK_WINDOW(window_handler->window)); gtk_widget_show_all(GTK_WIDGET(window_handler->window)); gtk_window_present(GTK_WINDOW(window_handler->window)); initialize_lua(window_handler, application_handler); gtk_notebook_set_tab_pos(GTK_NOTEBOOK(window_handler->notebook), application_handler->tabs_position); gtk_widget_set_visible(GTK_WIDGET(window_handler->action_bar), application_handler->show_action_bar); //gtk_widget_set_visible(window_handler->menu_bar, application_handler->show_menu_bar); gtk_widget_set_visible(GTK_WIDGET(window_handler->search_and_replace_bar), FALSE); if (application_handler->file_name) { gint i = 0; while (application_handler->file_name[i]) { g_printf("MM Open file \"%s\".\n", application_handler->file_name[i]); FILE *file = fopen(application_handler->file_name[i], "r"); fseek(file, 0, SEEK_END); int size = ftell(file); char *text = (char *)malloc(sizeof(char) * size + 1); memset(text, 0, sizeof(char) * size + 1); fseek(file, 0, SEEK_SET); fread(text, sizeof(char), size, file); create_page(window_handler, application_handler->file_name[i], text); fclose(file); i++; } } update_editor(window_handler); gtk_main(); g_printf("MM Closing Lua state.\n"); lua_close(application_handler->lua); return 0; }
static void activate (GApplication *gapp) { GtkApplication *app = GTK_APPLICATION (gapp); GtkWidget *window; GtkWidget *box; GtkWidget *grid; GtkWidget *label; GtkWidget *spin; GtkWidget *check; GtkWidget *bar; window = gtk_application_window_new (app); gtk_application_add_window (app, GTK_WINDOW (window)); bar = gtk_action_bar_new (); gtk_widget_set_no_show_all (bar, TRUE); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); grid = gtk_grid_new (); g_object_set (grid, "halign", GTK_ALIGN_CENTER, "margin", 20, "row-spacing", 12, "column-spacing", 12, NULL); gtk_box_pack_start (GTK_BOX (box), grid, FALSE, FALSE); label = gtk_label_new ("Start"); gtk_widget_set_halign (label, GTK_ALIGN_END); spin = gtk_spin_button_new_with_range (0, 10, 1); g_signal_connect (spin, "notify::value", G_CALLBACK (change_start), bar); gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1); gtk_grid_attach (GTK_GRID (grid), spin, 1, 0, 1, 1); label = gtk_label_new ("Center"); gtk_widget_set_halign (label, GTK_ALIGN_END); check = gtk_check_button_new (); g_signal_connect (check, "notify::active", G_CALLBACK (toggle_center), bar); gtk_grid_attach (GTK_GRID (grid), label, 0, 1, 1, 1); gtk_grid_attach (GTK_GRID (grid), check, 1, 1, 1, 1); label = gtk_label_new ("End"); gtk_widget_set_halign (label, GTK_ALIGN_END); spin = gtk_spin_button_new_with_range (0, 10, 1); g_signal_connect (spin, "notify::value", G_CALLBACK (change_end), bar); gtk_grid_attach (GTK_GRID (grid), label, 0, 2, 1, 1); gtk_grid_attach (GTK_GRID (grid), spin, 1, 2, 1, 1); label = gtk_label_new ("Visible"); gtk_widget_set_halign (label, GTK_ALIGN_END); check = gtk_check_button_new (); g_signal_connect (check, "notify::active", G_CALLBACK (toggle_visibility), bar); gtk_grid_attach (GTK_GRID (grid), label, 0, 3, 1, 1); gtk_grid_attach (GTK_GRID (grid), check, 1, 3, 1, 1); gtk_box_pack_end (GTK_BOX (box), bar, FALSE, FALSE); gtk_container_add (GTK_CONTAINER (window), box); gtk_widget_show_all (window); }
gint main (gint argc, gchar **argv) { GtkApplication *application; GApplicationFlags flags; gchar *path; GError *error = NULL; bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); gtk_init_with_args ( &argc, &argv, NULL, entries, GETTEXT_PACKAGE, &error); if (error != NULL) g_error ("%s", error->message); /* This installs handlers for our custom debug log levels. */ gva_get_debug_flags (); /* Change the working directory to that of the MAME executable. * Why? Because SDLMAME's default configuration uses relative * search paths such as "rompath = roms". The paths are relative * to the directory containing the MAME executable, so we must run * from that directory in order for SDLMAME's default configuration * to work. Annoying, but a common problem for users. */ path = g_path_get_dirname (MAME_PROGRAM); g_chdir (path); g_free (path); if (opt_inspect != NULL) { gchar *value; value = gva_mame_get_config_value (opt_inspect, &error); if (value != NULL) { g_print ("%s\n", value); g_free (value); } else { g_printerr ("%s\n", error->message); g_clear_error (&error); } exit (EXIT_SUCCESS); } if (opt_version) { g_print ("%s\n", PACKAGE_STRING); exit (EXIT_SUCCESS); } if (opt_which_emulator) { g_print ("%s\n", MAME_PROGRAM); exit (EXIT_SUCCESS); } /* Register the application with the session bus. */ flags = G_APPLICATION_FLAGS_NONE; application = gtk_application_new (APPLICATION_ID, flags); g_application_register (G_APPLICATION (application), NULL, &error); if (error != NULL) g_error ("%s", error->message); /* If another instance is running, exit now. */ if (g_application_get_is_remote (G_APPLICATION (application))) { gint exit_status; if (opt_build_database) { g_printerr ( "Cannot build database: " PACKAGE_NAME " is already running\n"); exit_status = EXIT_FAILURE; } else { g_application_activate (G_APPLICATION (application)); exit_status = EXIT_SUCCESS; } g_object_unref (application); exit (exit_status); } else { GtkWindow *window; window = GTK_WINDOW (GVA_WIDGET_MAIN_WINDOW); gtk_application_add_window (application, window); } gtk_window_set_default_icon_name (PACKAGE); if (!gva_db_init (&error)) g_error ("%s", error->message); gva_main_init (); gva_play_back_init (); gva_preferences_init (); gva_properties_init (); gva_ui_init (); gva_categories_init (&error); gva_error_handle (&error); gva_history_init (&error); gva_error_handle (&error); gva_nplayers_init (&error); gva_error_handle (&error); g_idle_add (idle_start, NULL); g_idle_add (tweak_css, NULL); gtk_main (); g_object_unref (application); return EXIT_SUCCESS; }
static void load_activated(GSimpleAction * action, GVariant * param, gpointer app) { GonepassAppWindow * win = gonepass_app_window_new(GONEPASS_APP(app)); gtk_application_add_window(app, GTK_WINDOW(win)); gtk_window_present(GTK_WINDOW(win)); }
static gboolean check_required_directories (NemoApplication *application) { char *user_directory; char *desktop_directory; GSList *directories; gboolean ret; g_assert (NEMO_IS_APPLICATION (application)); ret = TRUE; user_directory = nemo_get_user_directory (); desktop_directory = nemo_get_desktop_directory (); directories = NULL; if (!g_file_test (user_directory, G_FILE_TEST_IS_DIR)) { directories = g_slist_prepend (directories, user_directory); } if (!g_file_test (desktop_directory, G_FILE_TEST_IS_DIR)) { directories = g_slist_prepend (directories, desktop_directory); } if (directories != NULL) { int failed_count; GString *directories_as_string; GSList *l; char *error_string; const char *detail_string; GtkDialog *dialog; ret = FALSE; failed_count = g_slist_length (directories); directories_as_string = g_string_new ((const char *)directories->data); for (l = directories->next; l != NULL; l = l->next) { g_string_append_printf (directories_as_string, ", %s", (const char *)l->data); } if (failed_count == 1) { error_string = g_strdup_printf (_("Nemo could not create the required folder \"%s\"."), directories_as_string->str); detail_string = _("Before running Nemo, please create the following folder, or " "set permissions such that Nemo can create it."); } else { error_string = g_strdup_printf (_("Nemo could not create the following required folders: " "%s."), directories_as_string->str); detail_string = _("Before running Nemo, please create these folders, or " "set permissions such that Nemo can create them."); } dialog = eel_show_error_dialog (error_string, detail_string, NULL); /* We need the main event loop so the user has a chance to see the dialog. */ gtk_application_add_window (GTK_APPLICATION (application), GTK_WINDOW (dialog)); g_string_free (directories_as_string, TRUE); g_free (error_string); } g_slist_free (directories); g_free (user_directory); g_free (desktop_directory); return ret; }
static void gcm_picker_startup_cb (GApplication *application, GcmPickerPrivate *priv) { gboolean ret; GtkWidget *main_window; GtkWidget *widget; guint retval = 0; g_autoptr(GError) error = NULL; /* get UI */ priv->builder = gtk_builder_new (); retval = gtk_builder_add_from_resource (priv->builder, "/org/gnome/color-manager/gcm-picker.ui", &error); if (retval == 0) { g_warning ("failed to load ui: %s", error->message); return; } main_window = GTK_WIDGET (gtk_builder_get_object (priv->builder, "dialog_picker")); gtk_application_add_window (GTK_APPLICATION (application), GTK_WINDOW (main_window)); gtk_window_set_icon_name (GTK_WINDOW (main_window), GCM_STOCK_ICON); widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_measure")); g_signal_connect (widget, "clicked", G_CALLBACK (gcm_picker_measure_cb), priv); widget = GTK_WIDGET (gtk_builder_get_object (priv->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 (), PKGDATADIR G_DIR_SEPARATOR_S "icons"); /* create a last sample */ //cd_color_xyz_clear (&last_sample); /* set the parent window if it is specified */ if (priv->xid != 0) { g_debug ("Setting xid %u", priv->xid); gcm_window_set_parent_xid (GTK_WINDOW (main_window), priv->xid); } /* use an info bar if there is no device, or the wrong device */ priv->info_bar_hardware = gtk_info_bar_new (); priv->info_bar_hardware_label = gtk_label_new (NULL); gtk_info_bar_set_message_type (GTK_INFO_BAR(priv->info_bar_hardware), GTK_MESSAGE_INFO); widget = gtk_info_bar_get_content_area (GTK_INFO_BAR(priv->info_bar_hardware)); gtk_container_add (GTK_CONTAINER(widget), priv->info_bar_hardware_label); gtk_widget_show (priv->info_bar_hardware_label); /* add infobar to devices pane */ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "box1")); gtk_box_pack_start (GTK_BOX(widget), priv->info_bar_hardware, FALSE, FALSE, 0); /* maintain a list of profiles */ priv->client = cd_client_new (); ret = cd_client_connect_sync (priv->client, NULL, &error); if (!ret) { g_warning ("failed to connect to colord: %s", error->message); return; } g_signal_connect (priv->client, "sensor-added", G_CALLBACK (gcm_picker_sensor_client_changed_cb), priv); g_signal_connect (priv->client, "sensor-removed", G_CALLBACK (gcm_picker_sensor_client_changed_cb), priv); /* disable some ui if no hardware */ gcm_picker_sensor_client_setup_ui (priv); /* setup RGB combobox */ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "combobox_colorspace")); gcm_prefs_set_combo_simple_text (widget); gcm_prefs_setup_space_combobox (priv, widget); g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (gcm_prefs_space_combo_changed_cb), priv); /* setup initial preview window */ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "image_preview")); gtk_image_set_from_file (GTK_IMAGE (widget), DATADIR "/icons/hicolor/64x64/apps/gnome-color-manager.png"); /* wait */ gtk_widget_show (main_window); }
static void mail_browser_constructed (GObject *object) { EMailBrowser *browser; EMailReader *reader; EMailBackend *backend; EMailSession *session; EShellBackend *shell_backend; EShell *shell; EFocusTracker *focus_tracker; GtkAccelGroup *accel_group; GtkActionGroup *action_group; GtkAction *action; GtkUIManager *ui_manager; GtkWidget *container; GtkWidget *display; GtkWidget *widget; const gchar *domain; const gchar *id; guint merge_id; /* Chain up to parent's constructed() method. */ G_OBJECT_CLASS (e_mail_browser_parent_class)->constructed (object); browser = E_MAIL_BROWSER (object); reader = E_MAIL_READER (object); backend = e_mail_reader_get_backend (reader); session = e_mail_backend_get_session (backend); shell_backend = E_SHELL_BACKEND (backend); shell = e_shell_backend_get_shell (shell_backend); ui_manager = gtk_ui_manager_new (); browser->priv->ui_manager = ui_manager; domain = GETTEXT_PACKAGE; gtk_application_add_window ( GTK_APPLICATION (shell), GTK_WINDOW (object)); /* The message list is a widget, but it is not shown in the browser. * Unfortunately, the widget is inseparable from its model, and the * model is all we need. */ browser->priv->message_list = message_list_new (session); g_object_ref_sink (browser->priv->message_list); g_signal_connect_swapped ( browser->priv->message_list, "message-selected", G_CALLBACK (mail_browser_message_selected_cb), object); g_signal_connect_swapped ( browser->priv->message_list, "message-list-built", G_CALLBACK (mail_browser_message_list_built_cb), object); display = e_mail_display_new (e_mail_backend_get_remote_content (backend)); e_mail_display_set_mode ( E_MAIL_DISPLAY (display), browser->priv->display_mode); g_signal_connect_swapped ( display, "popup-event", G_CALLBACK (mail_browser_popup_event_cb), object); g_signal_connect_swapped ( display, "status-message", G_CALLBACK (mail_browser_status_message_cb), object); widget = e_preview_pane_new (E_WEB_VIEW (display)); browser->priv->preview_pane = g_object_ref (widget); gtk_widget_show (widget); action_group = gtk_action_group_new (ACTION_GROUP_STANDARD); gtk_action_group_set_translation_domain (action_group, domain); gtk_action_group_add_actions ( action_group, mail_browser_entries, G_N_ELEMENTS (mail_browser_entries), object); e_action_group_add_popup_actions ( action_group, mail_browser_popup_entries, G_N_ELEMENTS (mail_browser_popup_entries)); gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); /* For easy access. Takes ownership of the reference. */ g_object_set_data_full ( object, ACTION_GROUP_STANDARD, action_group, (GDestroyNotify) g_object_unref); action_group = gtk_action_group_new (ACTION_GROUP_SEARCH_FOLDERS); gtk_action_group_set_translation_domain (action_group, domain); gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); /* For easy access. Takes ownership of the reference. */ g_object_set_data_full ( object, ACTION_GROUP_SEARCH_FOLDERS, action_group, (GDestroyNotify) g_object_unref); e_mail_reader_init (reader, TRUE, TRUE); e_load_ui_manager_definition (ui_manager, E_MAIL_READER_UI_DEFINITION); gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, NULL); merge_id = gtk_ui_manager_new_merge_id (ui_manager); e_mail_reader_create_charset_menu (reader, ui_manager, merge_id); accel_group = gtk_ui_manager_get_accel_group (ui_manager); gtk_window_add_accel_group (GTK_WINDOW (object), accel_group); g_signal_connect_swapped ( ui_manager, "connect-proxy", G_CALLBACK (mail_browser_connect_proxy_cb), object); e_mail_reader_connect_remote_content (reader); /* Configure an EFocusTracker to manage selection actions. */ focus_tracker = e_focus_tracker_new (GTK_WINDOW (object)); action = e_mail_reader_get_action (reader, "cut-clipboard"); e_focus_tracker_set_cut_clipboard_action (focus_tracker, action); action = e_mail_reader_get_action (reader, "copy-clipboard"); e_focus_tracker_set_copy_clipboard_action (focus_tracker, action); action = e_mail_reader_get_action (reader, "paste-clipboard"); e_focus_tracker_set_paste_clipboard_action (focus_tracker, action); action = e_mail_reader_get_action (reader, "select-all"); e_focus_tracker_set_select_all_action (focus_tracker, action); browser->priv->focus_tracker = focus_tracker; /* Construct window widgets. */ widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_container_add (GTK_CONTAINER (object), widget); gtk_widget_show (widget); container = widget; widget = gtk_statusbar_new (); gtk_box_pack_end (GTK_BOX (container), widget, FALSE, FALSE, 0); browser->priv->statusbar = g_object_ref (widget); gtk_widget_show (widget); widget = gtk_ui_manager_get_widget (ui_manager, "/main-menu"); gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); browser->priv->main_menu = g_object_ref (widget); gtk_widget_show (widget); widget = gtk_ui_manager_get_widget (ui_manager, "/main-toolbar"); gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); browser->priv->main_toolbar = g_object_ref (widget); gtk_widget_show (widget); gtk_style_context_add_class ( gtk_widget_get_style_context (widget), GTK_STYLE_CLASS_PRIMARY_TOOLBAR); gtk_box_pack_start ( GTK_BOX (container), browser->priv->preview_pane, TRUE, TRUE, 0); id = "org.gnome.evolution.mail.browser"; e_plugin_ui_register_manager (ui_manager, id, object); e_plugin_ui_enable_manager (ui_manager, id); e_extensible_load_extensions (E_EXTENSIBLE (object)); }
static void gs_editor_startup_cb (GtkApplication *application, GsEditor *self) { GtkTextBuffer *buffer; GtkWidget *main_window; GtkWidget *widget; gboolean ret; guint retval; g_autoptr(GError) error = NULL; /* get UI */ retval = gtk_builder_add_from_resource (self->builder, "/org/gnome/Software/Editor/gs-editor.ui", &error); if (retval == 0) { g_warning ("failed to load ui: %s", error->message); return; } /* load all system appstream */ as_store_set_add_flags (self->store_global, AS_STORE_ADD_FLAG_USE_MERGE_HEURISTIC); ret = as_store_load (self->store_global, AS_STORE_LOAD_FLAG_IGNORE_INVALID | AS_STORE_LOAD_FLAG_APP_INFO_SYSTEM | AS_STORE_LOAD_FLAG_APPDATA | AS_STORE_LOAD_FLAG_DESKTOP, self->cancellable, &error); if (!ret) { g_warning ("failed to load global store: %s", error->message); return; } /* load all the IDs into the completion model */ gs_editor_load_completion_model (self); self->featured_tile1 = gs_feature_tile_new (NULL); self->upgrade_banner = gs_upgrade_banner_new (); widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "box_featured")); gtk_container_add (GTK_CONTAINER (widget), self->featured_tile1); gtk_container_add (GTK_CONTAINER (widget), self->upgrade_banner); widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "textview_css")); buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget)); g_signal_connect (buffer, "changed", G_CALLBACK (gs_design_dialog_buffer_changed_cb), self); widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "flowbox_main")); gtk_flow_box_set_sort_func (GTK_FLOW_BOX (widget), gs_editor_flow_box_sort_cb, self, NULL); widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_save")); g_signal_connect (widget, "clicked", G_CALLBACK (gs_editor_button_save_clicked_cb), self); widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_new_feature")); g_signal_connect (widget, "clicked", G_CALLBACK (gs_editor_button_new_feature_clicked_cb), self); widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_new_os_upgrade")); g_signal_connect (widget, "clicked", G_CALLBACK (gs_editor_button_new_os_upgrade_clicked_cb), self); widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_new")); g_signal_connect (widget, "clicked", G_CALLBACK (gs_editor_button_new_clicked_cb), self); widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_remove")); g_signal_connect (widget, "clicked", G_CALLBACK (gs_editor_button_remove_clicked_cb), self); widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_import")); g_signal_connect (widget, "clicked", G_CALLBACK (gs_editor_button_import_clicked_cb), self); widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_back")); g_signal_connect (widget, "clicked", G_CALLBACK (gs_editor_button_back_clicked_cb), self); widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_menu")); g_signal_connect (widget, "clicked", G_CALLBACK (gs_editor_button_menu_clicked_cb), self); widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_notification_dismiss")); g_signal_connect (widget, "clicked", G_CALLBACK (gs_editor_button_notification_dismiss_clicked_cb), self); widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_notification_undo_remove")); g_signal_connect (widget, "clicked", G_CALLBACK (gs_editor_button_undo_remove_clicked_cb), self); widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "checkbutton_editors_pick")); g_signal_connect (widget, "toggled", G_CALLBACK (gs_editor_checkbutton_editors_pick_cb), self); widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "checkbutton_category_featured")); g_signal_connect (widget, "toggled", G_CALLBACK (gs_editor_checkbutton_category_featured_cb), self); widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "entry_desktop_id")); g_signal_connect (widget, "notify::text", G_CALLBACK (gs_editor_entry_desktop_id_notify_cb), self); widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "entry_name")); g_signal_connect (widget, "notify::text", G_CALLBACK (gs_editor_entry_name_notify_cb), self); widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "entry_summary")); g_signal_connect (widget, "notify::text", G_CALLBACK (gs_editor_entry_summary_notify_cb), self); widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "window_main")); g_signal_connect (widget, "delete_event", G_CALLBACK (gs_editor_delete_event_cb), self); /* clear entries */ gs_editor_refresh_choice (self); gs_editor_refresh_details (self); gs_editor_refresh_file (self, NULL); /* set the appropriate page */ gs_editor_set_page (self, "none"); main_window = GTK_WIDGET (gtk_builder_get_object (self->builder, "window_main")); gtk_application_add_window (application, GTK_WINDOW (main_window)); gtk_widget_show (main_window); }
/* object libre impuesto window constructed */ static void libre_impuesto_window_constructed (GObject *object) { GtkBox *box; GtkPaned *paned; GtkWidget *widget; GtkWidget *notebook; GtkWidget *background; LibreImpuesto *impuesto; LibreImpuestoWindow *impuesto_window = LIBRE_IMPUESTO_WINDOW (object); LibreImpuestoWindowPrivate *priv = impuesto_window->priv; impuesto = libre_impuesto_window_get_impuesto (impuesto_window); libre_impuesto_window_actions_init(impuesto_window); // Create a GtkBox container widget = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_container_add (GTK_CONTAINER (impuesto_window), widget); box = GTK_BOX (widget); widget = libre_impuesto_window_construct_menubar (impuesto_window); if (widget != NULL) gtk_box_pack_start (box, widget, FALSE, FALSE, 0); widget = libre_impuesto_window_construct_headerbar (impuesto_window); if (widget != NULL) gtk_box_pack_start (box, widget, FALSE, FALSE, 0); widget = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL); gtk_box_pack_start (box, widget, TRUE, TRUE, 0); paned = GTK_PANED (widget); widget = gtk_statusbar_new(); g_object_bind_property ( impuesto_window, "statusbar-visible", widget, "visible", G_BINDING_SYNC_CREATE); gtk_statusbar_push (GTK_STATUSBAR (widget), 1, PACKAGE_STRING); gtk_box_pack_start (box, widget, FALSE, FALSE, 0); widget = gtk_statusbar_get_message_area (GTK_STATUSBAR (widget)); gtk_widget_set_halign (widget, GTK_ALIGN_END); widget = libre_impuesto_window_construct_sidebar (impuesto, impuesto_window); if (widget != NULL) gtk_paned_pack1 (paned, widget, FALSE, FALSE); background = gtk_drawing_area_new(); gtk_widget_set_name (background, "libre-impuesto-background"); g_signal_connect (background, "draw", G_CALLBACK (draw_area_cb), NULL); notebook = impuesto_notebook_new(); priv->notebook = GTK_NOTEBOOK (notebook); g_object_set_data ( G_OBJECT(impuesto_window), "notebook", notebook); g_signal_connect ( GTK_NOTEBOOK (notebook), "tab-close-request", G_CALLBACK (notebook_page_close_request_cb), impuesto_window); g_signal_connect ( GTK_NOTEBOOK (notebook), "switch-page", G_CALLBACK (switch_page_cb), impuesto_window); widget = gtk_stack_new(); priv->stack = GTK_STACK (widget); gtk_container_add_with_properties (GTK_CONTAINER (widget), background, "name", "background", NULL); gtk_container_add_with_properties (GTK_CONTAINER (widget), notebook, "name", "notebook", NULL); if (widget != NULL) gtk_paned_pack2 (paned, widget, TRUE, FALSE); gtk_widget_show_all (GTK_WIDGET(box)); //gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 0); gtk_application_add_window (GTK_APPLICATION (impuesto), GTK_WINDOW(impuesto_window)); /* Chain up to parent's constructed() method. */ G_OBJECT_CLASS (libre_impuesto_window_parent_class)->constructed (object); }
static gboolean check_required_directories (NautilusApplication *application) { char *user_directory; char *desktop_directory; GSList *directories; gboolean ret; g_assert (NAUTILUS_IS_APPLICATION (application)); nautilus_profile_start (NULL); ret = TRUE; user_directory = nautilus_get_user_directory (); desktop_directory = nautilus_get_desktop_directory (); directories = NULL; if (!g_file_test (user_directory, G_FILE_TEST_IS_DIR)) { directories = g_slist_prepend (directories, user_directory); } if (!g_file_test (desktop_directory, G_FILE_TEST_IS_DIR)) { directories = g_slist_prepend (directories, desktop_directory); } if (directories != NULL) { int failed_count; GString *directories_as_string; GSList *l; char *error_string; const char *detail_string; GtkDialog *dialog; ret = FALSE; failed_count = g_slist_length (directories); directories_as_string = g_string_new ((const char *)directories->data); for (l = directories->next; l != NULL; l = l->next) { g_string_append_printf (directories_as_string, ", %s", (const char *)l->data); } error_string = _("Oops! Something went wrong."); if (failed_count == 1) { detail_string = g_strdup_printf (_("Unable to create a required folder. " "Please create the following folder, or " "set permissions such that it can be created:\n%s"), directories_as_string->str); } else { detail_string = g_strdup_printf (_("Unable to create required folders. " "Please create the following folders, or " "set permissions such that they can be created:\n%s"), directories_as_string->str); } dialog = eel_show_error_dialog (error_string, detail_string, NULL); /* We need the main event loop so the user has a chance to see the dialog. */ gtk_application_add_window (GTK_APPLICATION (application), GTK_WINDOW (dialog)); g_string_free (directories_as_string, TRUE); } g_slist_free (directories); g_free (user_directory); g_free (desktop_directory); nautilus_profile_end (NULL); return ret; }