void initialize_app_menubar (GApplication *application) { GtkBuilder *builder; GSettings *settings; g_action_map_add_action_entries (G_ACTION_MAP (application), app_menu_entries, G_N_ELEMENTS (app_menu_entries), application); builder = _gtk_builder_new_from_resource ("app-menubar.ui"); gtk_application_set_menubar (GTK_APPLICATION (application), G_MENU_MODEL (gtk_builder_get_object (builder, "app-menubar"))); g_object_unref (builder); settings = fr_application_get_settings (FR_APPLICATION (application), FILE_ROLLER_SCHEMA_UI); g_simple_action_set_state (GET_ACTION (PREF_UI_VIEW_SIDEBAR), g_variant_new_boolean (g_settings_get_boolean (settings, PREF_UI_VIEW_SIDEBAR))); settings = fr_application_get_settings (FR_APPLICATION (application), FILE_ROLLER_SCHEMA_LISTING); g_simple_action_set_state (GET_ACTION (PREF_LISTING_LIST_MODE), g_variant_new_string (_g_enum_type_get_value (FR_TYPE_WINDOW_LIST_MODE, g_settings_get_enum (settings, PREF_LISTING_LIST_MODE))->value_nick)); g_signal_connect (fr_application_get_settings (FR_APPLICATION (application), FILE_ROLLER_SCHEMA_UI), "changed::" PREF_UI_VIEW_SIDEBAR, G_CALLBACK (pref_view_sidebar_changed), application); g_signal_connect (fr_application_get_settings (FR_APPLICATION (application), FILE_ROLLER_SCHEMA_LISTING), "changed::" PREF_LISTING_LIST_MODE, G_CALLBACK (pref_list_mode_changed), application); }
void gw_application_set_win_menubar (GwApplication *application, GMenuModel *menumodel) { //Sanity checks g_return_if_fail (application != NULL); g_return_if_fail (menumodel != NULL); if (g_menu_model_get_n_items (menumodel) == 0) return; //Declarations GMenuModel *menubar; gint length; //Initializations menubar = gtk_application_get_menubar (GTK_APPLICATION (application)); g_return_if_fail (menubar != NULL); length = g_menu_model_get_n_items (menubar); //Clear the menubar while (length-- > 0) g_menu_remove (G_MENU (menubar), 0); //Add the menuitem linking the menus { GMenuItem *menuitem = g_menu_item_new_section (NULL, menumodel); if (menuitem != NULL) { g_menu_append_item (G_MENU (menubar), menuitem); g_object_unref (menuitem); menuitem = NULL; } gw_application_add_accelerators (application, menubar); } }
static void gw_application_load_menubar (GwApplication *application) { GMenuModel *menumodel; menumodel = G_MENU_MODEL (g_menu_new ()); gtk_application_set_menubar (GTK_APPLICATION (application), menumodel); }
static int trg_gtk_app_command_line(GApplication * application, GApplicationCommandLine * cmdline) { GList *windows = gtk_application_get_windows(GTK_APPLICATION(application)); TrgMainWindow *window; gchar **argv; if (!windows || !windows->data) return 1; window = TRG_MAIN_WINDOW(windows->data); argv = g_application_command_line_get_arguments(cmdline, NULL); if (g_application_command_line_get_is_remote(cmdline)) { if (!argv[0]) { gtk_window_present(GTK_WINDOW(window)); g_strfreev(argv); } else { return trg_add_from_filename(window, argv); } } else { trg_main_window_set_start_args(window, argv); auto_connect_if_required(TRG_MAIN_WINDOW(windows->data)); } return 0; }
void ide_application_actions_update (IdeApplication *self) { GList *windows; GAction *action; gboolean enabled; g_assert (IDE_IS_APPLICATION (self)); /* * We only enable the preferences action if we have a workbench open * that is past the greeter. */ action = g_action_map_lookup_action (G_ACTION_MAP (self), "preferences"); enabled = FALSE; for (windows = gtk_application_get_windows (GTK_APPLICATION (self)); windows != NULL; windows = windows->next) { GtkWindow *window = windows->data; if (IDE_IS_WORKBENCH (window) && !ide_str_equal0 ("greeter", ide_workbench_get_visible_perspective_name (IDE_WORKBENCH (window)))) { enabled = TRUE; break; } } g_simple_action_set_enabled (G_SIMPLE_ACTION (action), enabled); }
static void get_network_available (GNetworkMonitor *monitor, gboolean available, GeditApp *app) { gboolean enable; GList *windows, *w; enable = g_network_monitor_get_network_available (monitor); windows = gtk_application_get_windows (GTK_APPLICATION (app)); for (w = windows; w != NULL; w = w->next) { GeditWindow *window = GEDIT_WINDOW (w->data); if (GEDIT_IS_WINDOW (window)) { GList *tabs, *t; tabs = _gedit_window_get_all_tabs (window); for (t = tabs; t != NULL; t = t->next) { _gedit_tab_set_network_available (GEDIT_TAB (t->data), enable); } g_list_free (tabs); } } }
static void openoffice_missing_unoconv (NemoPreviewPdfLoader *self) { GApplication *app = g_application_get_default (); GtkWidget *widget = GTK_WIDGET (gtk_application_get_active_window (GTK_APPLICATION (app))); GDBusConnection *connection = g_application_get_dbus_connection (app); guint xid = 0; GdkWindow *gdk_window; const gchar *unoconv_path[2]; gdk_window = gtk_widget_get_window (widget); if (gdk_window != NULL) xid = GDK_WINDOW_XID (gdk_window); unoconv_path[0] = "/usr/bin/unoconv"; unoconv_path[1] = NULL; g_dbus_connection_call (connection, "org.freedesktop.PackageKit", "/org/freedesktop/PackageKit", "org.freedesktop.PackageKit.Modify", "InstallProvideFiles", g_variant_new ("(u^ass)", xid, unoconv_path, "hide-confirm-deps"), NULL, G_DBUS_CALL_FLAGS_NONE, G_MAXINT, NULL, openoffice_missing_unoconv_ready_cb, self); }
static void activate_wizard(GApplication *app, gpointer user_data) { create_assistant(GTK_APPLICATION(app), *(int *)user_data); update_gui_state_from_problem_data(UPDATE_SELECTED_EVENT); }
static gboolean maybe_open_with_existing_workspace (IdeApplication *self, GFile *file, const gchar *hint, GCancellable *cancellable) { GList *windows; GList *iter; g_assert (IDE_IS_APPLICATION (self)); g_assert (G_IS_FILE (file)); windows = gtk_application_get_windows (GTK_APPLICATION (self)); for (iter = windows; iter != NULL; iter = iter->next) { GtkWindow *window = iter->data; if (IDE_IS_WORKBENCH (window) && workbench_manages_file (IDE_WORKBENCH (window), file)) { ide_workbench_open_files_async (IDE_WORKBENCH (window), &file, 1, hint, 0, cancellable, NULL, NULL); return TRUE; } } return FALSE; }
/* Startup function for the menu we are creating in this sample */ static void startup (GApplication *app, gpointer user_data) { GMenu *menu; GSimpleAction *quit_action; /* Initialize the GMenu, and add a menu item with label "About" and action * "win.about". Also add another menu item with label "Quit" and action * "app.quit" */ menu = g_menu_new (); g_menu_append (menu, "About", "win.about"); g_menu_append (menu, "Quit", "app.quit"); /* Create a new simple action for the application. (In this case it is the * "quit" action. */ quit_action = g_simple_action_new ("quit", NULL); /* Ensure that the menu we have just created is set for the overall application */ gtk_application_set_app_menu (GTK_APPLICATION (app), G_MENU_MODEL (menu)); g_signal_connect (quit_action, "activate", G_CALLBACK (quit_cb), app); g_action_map_add_action (G_ACTION_MAP (app), G_ACTION (quit_action)); }
static void impl_deactivate (PeasActivatable *plugin) { XplayerScreensaverPlugin *pi = XPLAYER_SCREENSAVER_PLUGIN (plugin); g_object_unref (pi->priv->settings); if (pi->priv->handler_id_playing != 0) { XplayerObject *xplayer; xplayer = g_object_get_data (G_OBJECT (plugin), "object"); g_signal_handler_disconnect (G_OBJECT (xplayer), pi->priv->handler_id_playing); pi->priv->handler_id_playing = 0; } if (pi->priv->handler_id_metadata != 0) { g_signal_handler_disconnect (G_OBJECT (pi->priv->bvw), pi->priv->handler_id_metadata); pi->priv->handler_id_metadata = 0; } if (pi->priv->inhibit_cookie != 0) { gtk_application_uninhibit (GTK_APPLICATION (pi->priv->xplayer), pi->priv->inhibit_cookie); pi->priv->inhibit_cookie = 0; } g_object_unref (pi->priv->xplayer); g_object_unref (pi->priv->bvw); }
static void gw_window_constructed (GObject *object) { GwWindow *window; GwWindowPrivate *priv; gboolean os_shows_app_menu; GtkSettings *settings; //Chain the parent class { G_OBJECT_CLASS (gw_window_parent_class)->constructed (object); } window = GW_WINDOW (object); priv = window->priv; settings = gtk_settings_get_default (); g_object_get (settings, "gtk-shell-shows-app-menu", &os_shows_app_menu, NULL); gtk_widget_add_events (GTK_WIDGET (window), GDK_FOCUS_CHANGE_MASK); gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW (window), FALSE); priv->accelgroup = gtk_accel_group_new (); gtk_window_add_accel_group (GTK_WINDOW (window), priv->accelgroup); gtk_window_set_application (GTK_WINDOW (window), GTK_APPLICATION (priv->application)); priv->builder = gtk_builder_new (); gw_window_load_ui_xml (window, priv->ui_xml); priv->toplevel = GTK_WIDGET (gw_window_get_object (GW_WINDOW (window), "toplevel")); g_signal_connect (G_OBJECT (window), "configure-event", G_CALLBACK (gw_window_configure_event_cb), NULL); g_signal_connect (window, "focus-in-event", G_CALLBACK (gw_window_focus_in_event_cb), NULL); }
static void refimpl_app_startup(GApplication* application) { RefImplApp* app = REFIMPL_APP(application); G_APPLICATION_CLASS(refimpl_app_parent_class)->startup(application); g_action_map_add_action_entries(G_ACTION_MAP(app), app_entries, G_N_ELEMENTS(app_entries), app); if (refimpl_app_has_app_menu(app)) { GtkBuilder* builder; GError* error = NULL; builder = gtk_builder_new(); if (!gtk_builder_add_from_resource(builder, "/com/bobtacoindustries/N3888_RefImpl/refimpl_menu.ui", &error)) { g_warning("Loading menu builder file failed. Message: %s", error->message); g_error_free(error); } else { GMenuModel* appMenu; appMenu = G_MENU_MODEL(gtk_builder_get_object(builder, "app_menu")); gtk_application_set_app_menu(GTK_APPLICATION(application), appMenu); } g_object_unref(builder); } //setup_accelerators(app); }
static void shell_action_new_window_cb (GSimpleAction *action, GVariant *parameter, EShell *shell) { GtkApplication *application; GList *list; const gchar *view_name; application = GTK_APPLICATION (shell); list = gtk_application_get_windows (application); view_name = g_variant_get_string (parameter, NULL); /* Present the first EShellWindow showing 'view_name'. */ while (list != NULL) { GtkWindow *window = GTK_WINDOW (list->data); if (E_IS_SHELL_WINDOW (window)) { const gchar *active_view; active_view = e_shell_window_get_active_view ( E_SHELL_WINDOW (window)); if (g_strcmp0 (active_view, view_name) == 0) { gtk_window_present (window); return; } } list = g_list_next (list); } /* No suitable EShellWindow found, so create one. */ e_shell_create_shell_window (shell, view_name); }
/************************************************************ APP Main Window */ static void bmd_activate (GtkApplication *app, gpointer data) { bmd_widgets *a = (bmd_widgets *) data; /* create a window with title, default size, icon and a box container */ a->window = gtk_application_window_new (app); gtk_window_set_application (GTK_WINDOW (a->window), GTK_APPLICATION (app)); gtk_window_set_position (GTK_WINDOW (a->window), GTK_WIN_POS_CENTER); gtk_window_set_title (GTK_WINDOW (a->window), "Book Management Demo"); gtk_window_set_default_size (GTK_WINDOW (a->window), XSIZE, YSIZE); gtk_window_set_default_icon_from_file ("bmd_icon.png", NULL); a->box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_container_add (GTK_CONTAINER (a->window), a->box); /* moved the creation of the menu to a dedicated function */ bmd_construct_menu (app, (gpointer) a); a->paned = gtk_paned_new (GTK_ORIENTATION_VERTICAL); gtk_box_pack_start (GTK_BOX (a->box), a->paned, TRUE, TRUE, 0); bmd_construct_editablecells (app, (gpointer) a); bmd_construct_imagedemo (app, (gpointer) a); gtk_widget_show_all (GTK_WIDGET (a->window)); }
static void terminal_app_startup (GApplication *application) { const GActionEntry app_menu_actions[] = { { "preferences", app_menu_preferences_cb, NULL, NULL, NULL }, { "help", app_menu_help_cb, NULL, NULL, NULL }, { "about", app_menu_about_cb, NULL, NULL, NULL }, { "quit", app_menu_quit_cb, NULL, NULL, NULL } }; gs_unref_object GtkBuilder *builder; GError *error = NULL; G_APPLICATION_CLASS (terminal_app_parent_class)->startup (application); /* Need to set the WM class (bug #685742) */ gdk_set_program_class("Gnome-terminal"); g_action_map_add_action_entries (G_ACTION_MAP (application), app_menu_actions, G_N_ELEMENTS (app_menu_actions), application); builder = gtk_builder_new (); gtk_builder_add_from_resource (builder, TERMINAL_RESOURCES_PATH_PREFIX "ui/terminal-appmenu.ui", &error); g_assert_no_error (error); gtk_application_set_app_menu (GTK_APPLICATION (application), G_MENU_MODEL (gtk_builder_get_object (builder, "appmenu"))); _terminal_debug_print (TERMINAL_DEBUG_SERVER, "Startup complete\n"); }
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 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); }
GeditMenuExtension * _gedit_app_extend_menu (GeditApp *app, const gchar *extension_point) { GeditAppPrivate *priv; GMenuModel *model; GMenuModel *section; g_return_val_if_fail (GEDIT_IS_APP (app), NULL); g_return_val_if_fail (extension_point != NULL, NULL); priv = gedit_app_get_instance_private (app); /* First look in the window menu */ section = find_extension_point_section (priv->window_menu, extension_point); /* otherwise look in the app menu */ if (section == NULL) { model = gtk_application_get_app_menu (GTK_APPLICATION (app)); if (model != NULL) { section = find_extension_point_section (model, extension_point); } } return section != NULL ? gedit_menu_extension_new (G_MENU (section)) : NULL; }
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 application_startup_cb (GApplication *application, GnomeControlCenter *shell) { GMenu *menu, *section; GAction *action; action = G_ACTION (g_simple_action_new ("help", NULL)); g_action_map_add_action (G_ACTION_MAP (application), action); g_signal_connect (action, "activate", G_CALLBACK (help_activated), shell); action = G_ACTION (g_simple_action_new ("quit", NULL)); g_action_map_add_action (G_ACTION_MAP (application), action); g_signal_connect (action, "activate", G_CALLBACK (quit_activated), shell); menu = g_menu_new (); section = g_menu_new (); g_menu_append (section, _("Help"), "app.help"); g_menu_append (section, _("Quit"), "app.quit"); g_menu_append_section (menu, NULL, G_MENU_MODEL (section)); gtk_application_set_app_menu (GTK_APPLICATION (application), G_MENU_MODEL (menu)); /* nothing else to do here, we don't want to show a window before * we've looked at the commandline */ }
static void cem_application_startup(GApplication * app) { GtkBuilder *builder; GMenuModel *app_menu; const gchar *quit_accels[2] ={"<Ctrl >Q", NULL}; G_APPLICATION_CLASS(cem_application_parent_class)->startup(app); g_action_map_add_action_entries (G_ACTION_MAP(app), app_entries, G_N_ELEMENTS(app_entries), app); gtk_application_set_accels_for_action(GTK_APPLICATION(app), "app.quit", quit_accels); builder = gtk_builder_new_from_resource("/org/bandari/cem/glade/cem_menu.glade"); // app_menu = G_MENU_MODEL (gtk_builder_get_object(builder, "appmenu")); // gtk_application_set_app_menu(GTK_APPLICATION(app), app_menu); g_object_unref(builder); }
static void ide_application_actions_help (GSimpleAction *action, GVariant *param, gpointer user_data) { IdeApplication *self = user_data; GtkWindow *focused_window= NULL; GdkScreen *screen = NULL; GError *err = NULL; g_assert (IDE_IS_APPLICATION (self)); focused_window = gtk_application_get_active_window (GTK_APPLICATION (self)); screen = gtk_window_get_screen (focused_window); gtk_show_uri (screen, "help:gnome-builder", gtk_get_current_event_time (), &err); if (err) { g_message ("Unable to open help: %s\n", err->message); g_error_free (err); } }
static void activate (GApplication *app) { GtkBuilder *builder; GtkWidget *window; GtkWidget *grid; GtkWidget *contents; GtkWidget *status; GtkWidget *message; GtkWidget *button; GtkWidget *infobar; GtkWidget *menutool; GMenuModel *toolmenu; GtkTextBuffer *buffer; window = gtk_application_window_new (GTK_APPLICATION (app)); gtk_window_set_title (GTK_WINDOW (window), "Application Class"); gtk_window_set_icon_name (GTK_WINDOW (window), "document-open"); gtk_window_set_default_size (GTK_WINDOW (window), 200, 200); g_action_map_add_action_entries (G_ACTION_MAP (window), win_entries, G_N_ELEMENTS (win_entries), window); builder = gtk_builder_new (); gtk_builder_add_from_resource (builder, "/application/application.ui", NULL); grid = (GtkWidget *)gtk_builder_get_object (builder, "grid"); contents = (GtkWidget *)gtk_builder_get_object (builder, "contents"); status = (GtkWidget *)gtk_builder_get_object (builder, "status"); message = (GtkWidget *)gtk_builder_get_object (builder, "message"); button = (GtkWidget *)gtk_builder_get_object (builder, "button"); infobar = (GtkWidget *)gtk_builder_get_object (builder, "infobar"); menutool = (GtkWidget *)gtk_builder_get_object (builder, "menutool"); toolmenu = (GMenuModel *)gtk_builder_get_object (builder, "toolmenu"); g_object_set_data (G_OBJECT (window), "message", message); g_object_set_data (G_OBJECT (window), "infobar", infobar); gtk_container_add (GTK_CONTAINER (window), grid); gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (menutool), gtk_menu_new_from_model (toolmenu)); gtk_widget_grab_focus (contents); g_signal_connect (button, "clicked", G_CALLBACK (clicked_cb), infobar); /* Show text widget info in the statusbar */ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (contents)); g_signal_connect_object (buffer, "changed", G_CALLBACK (update_statusbar), status, 0); g_signal_connect_object (buffer, "mark-set", G_CALLBACK (mark_set_callback), status, 0); update_statusbar (buffer, GTK_STATUSBAR (status)); gtk_widget_show_all (window); g_object_unref (builder); }
static void _brio_application_set_app_menu (GApplication *app) { GMenu *app_menu = g_menu_new (); GSimpleAction *about; GSimpleAction *quit; about = g_simple_action_new ("about", NULL); g_signal_connect (about, "activate", G_CALLBACK (_brio_application_show_about), app); g_action_map_add_action ( G_ACTION_MAP (app), G_ACTION (about)); g_menu_append (app_menu, _("About"), "app.about"); quit = g_simple_action_new ("quit", NULL); g_signal_connect (quit, "activate", G_CALLBACK (_brio_application_quit), app); g_action_map_add_action ( G_ACTION_MAP (app), G_ACTION (quit)); g_menu_append (app_menu, _("Quit"), "app.quit"); gtk_application_set_app_menu (GTK_APPLICATION (app), G_MENU_MODEL (app_menu)); }
static void switch_to_item (BjbMainView *view, BijiItem *to_open) { if (BIJI_IS_NOTE_OBJ (to_open)) { /* If the note is already opened in another window, just show it. */ if (biji_note_obj_is_opened (BIJI_NOTE_OBJ (to_open))) { GList *notes ; notes = gtk_application_get_windows(GTK_APPLICATION(g_application_get_default())); g_list_foreach (notes, show_window_if_note, to_open); return ; } /* Otherwise, leave main view */ switch_to_note_view (view, BIJI_NOTE_OBJ (to_open)); } /* Notebook * TODO : check if already opened (same as above) */ else if (BIJI_IS_NOTEBOOK (to_open)) { bjb_controller_set_notebook (view->priv->controller, BIJI_NOTEBOOK (to_open)); } }
void gw_application_initialize_accelerators (GwApplication *application) { //Sanity checks g_return_if_fail (application != NULL); //Declarations gchar *accel; gchar *action; gchar *detail; gint index; //Initializations index = 1; while (index + 1 < 10) { accel = g_strdup_printf ("<Alt>%d", index); action = g_strdup_printf ("win.set-dictionary"); detail = g_strdup_printf ("%d", index); if (accel != NULL && action != NULL && detail != NULL) { gtk_application_add_accelerator (GTK_APPLICATION (application), accel, action, g_variant_new_string (detail)); index++; } if (accel != NULL) g_free (accel); accel = NULL; if (action != NULL) g_free (action); action = NULL; if (detail != NULL) g_free (detail); detail = NULL; } }
static void impl_deactivate (PeasActivatable *plugin) { TotemMoviePropertiesPlugin *pi; TotemObject *totem; pi = TOTEM_MOVIE_PROPERTIES_PLUGIN (plugin); totem = g_object_get_data (G_OBJECT (plugin), "object"); g_signal_handler_disconnect (G_OBJECT (totem), pi->priv->handler_id_stream_length); g_signal_handlers_disconnect_by_func (G_OBJECT (totem), totem_movie_properties_plugin_metadata_updated, plugin); g_signal_handlers_disconnect_by_func (G_OBJECT (totem), totem_movie_properties_plugin_file_opened, plugin); g_signal_handlers_disconnect_by_func (G_OBJECT (totem), totem_movie_properties_plugin_file_closed, plugin); pi->priv->handler_id_stream_length = 0; gtk_application_remove_accelerator (GTK_APPLICATION (totem), "app.properties", NULL); totem_object_empty_menu_section (totem, "properties-placeholder"); }
static gboolean launch_search_cb (GcalShellSearchProvider *search_provider, GDBusMethodInvocation *invocation, gchar **terms, guint32 timestamp, GcalShellSearchProvider2 *skel) { GApplication *application; gchar *terms_joined; GList *windows; application = g_application_get_default (); g_application_activate (application); terms_joined = g_strjoinv (" ", terms); windows = g_list_reverse (gtk_application_get_windows (GTK_APPLICATION (application))); if (windows != NULL) { gcal_window_set_search_mode (GCAL_WINDOW (windows->data), TRUE); gcal_window_set_search_query (GCAL_WINDOW (windows->data), terms_joined); g_list_free (windows); } g_free (terms_joined); return TRUE; }
/** * 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); }