static void ide_editor_view_class_init (IdeEditorViewClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); IdeLayoutViewClass *view_class = IDE_LAYOUT_VIEW_CLASS (klass); object_class->finalize = ide_editor_view_finalize; object_class->get_property = ide_editor_view_get_property; object_class->set_property = ide_editor_view_set_property; widget_class->destroy = ide_editor_view_destroy; widget_class->grab_focus = ide_editor_view_grab_focus; widget_class->get_request_mode = ide_editor_view_get_request_mode; widget_class->get_preferred_height = ide_editor_view_get_preferred_height; widget_class->hierarchy_changed = ide_editor_view_hierarchy_changed; view_class->create_split = ide_editor_view_create_split; view_class->get_special_title = ide_editor_view_get_special_title; view_class->get_modified = ide_editor_view_get_modified; view_class->set_split_view = ide_editor_view_set_split_view; view_class->set_back_forward_list = ide_editor_view_set_back_forward_list; view_class->navigate_to = ide_editor_view_navigate_to; view_class->get_title = ide_editor_view_get_title; properties [PROP_DOCUMENT] = g_param_spec_object ("document", "Document", "The editor document.", IDE_TYPE_BUFFER, (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); g_object_class_install_properties (object_class, LAST_PROP, properties); signals [REQUEST_DOCUMENTATION] = g_signal_new ("request-documentation", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, 0, NULL, NULL, NULL, G_TYPE_NONE, 1, G_TYPE_STRING); gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/builder/ui/ide-editor-view.ui"); gtk_widget_class_bind_template_child (widget_class, IdeEditorView, cursor_label); gtk_widget_class_bind_template_child (widget_class, IdeEditorView, frame1); gtk_widget_class_bind_template_child (widget_class, IdeEditorView, modified_cancel_button); gtk_widget_class_bind_template_child (widget_class, IdeEditorView, modified_revealer); gtk_widget_class_bind_template_child (widget_class, IdeEditorView, paned); gtk_widget_class_bind_template_child (widget_class, IdeEditorView, progress_bar); gtk_widget_class_bind_template_child (widget_class, IdeEditorView, tweak_button); gtk_widget_class_bind_template_child (widget_class, IdeEditorView, tweak_widget); gtk_widget_class_bind_template_child (widget_class, IdeEditorView, goto_line_button); gtk_widget_class_bind_template_child (widget_class, IdeEditorView, goto_line_popover); gtk_widget_class_bind_template_child (widget_class, IdeEditorView, warning_button); g_type_ensure (IDE_TYPE_EDITOR_FRAME); g_type_ensure (IDE_TYPE_EDITOR_TWEAK_WIDGET); }
static void gis_language_page_init (GisLanguagePage *page) { g_resources_register (language_get_resource ()); g_type_ensure (GIS_TYPE_WELCOME_WIDGET); g_type_ensure (CC_TYPE_LANGUAGE_CHOOSER); gtk_widget_init_template (GTK_WIDGET (page)); }
static void gis_account_page_init (GisAccountPage *page) { g_resources_register (account_get_resource ()); g_type_ensure (GIS_TYPE_ACCOUNT_PAGE_LOCAL); g_type_ensure (GIS_TYPE_ACCOUNT_PAGE_ENTERPRISE); gtk_widget_init_template (GTK_WIDGET (page)); }
QGnomePlatformTheme::QGnomePlatformTheme() { loadSettings(); /* Initialize some types here so that Gtk+ does not crash when reading * the treemodel for GtkFontChooser. */ g_type_ensure(PANGO_TYPE_FONT_FAMILY); g_type_ensure(PANGO_TYPE_FONT_FACE); }
static void ide_frame_class_init (IdeFrameClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass); object_class->constructed = ide_frame_constructed; object_class->get_property = ide_frame_get_property; object_class->set_property = ide_frame_set_property; widget_class->destroy = ide_frame_destroy; widget_class->grab_focus = ide_frame_grab_focus; container_class->add = ide_frame_add; klass->agree_to_close_async = ide_frame_real_agree_to_close_async; klass->agree_to_close_finish = ide_frame_real_agree_to_close_finish; properties [PROP_HAS_VIEW] = g_param_spec_boolean ("has-page", NULL, NULL, FALSE, (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); properties [PROP_VISIBLE_CHILD] = g_param_spec_object ("visible-child", "Visible Child", "The current page to be displayed", IDE_TYPE_PAGE, (G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS)); g_object_class_install_properties (object_class, N_PROPS, properties); signals [CHNAGE_CURRENT_PAGE] = g_signal_new_class_handler ("change-current-page", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_CALLBACK (ide_frame_change_current_page), NULL, NULL, g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT); gtk_widget_class_set_css_name (widget_class, "ideframe"); gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/libide-gui/ui/ide-frame.ui"); gtk_widget_class_bind_template_child_private (widget_class, IdeFrame, empty_placeholder); gtk_widget_class_bind_template_child_private (widget_class, IdeFrame, failed_state); gtk_widget_class_bind_template_child_private (widget_class, IdeFrame, header); gtk_widget_class_bind_template_child_private (widget_class, IdeFrame, stack); gtk_widget_class_bind_template_child_private (widget_class, IdeFrame, top_stack); gtk_widget_class_bind_template_child_private (widget_class, IdeFrame, event_box); g_type_ensure (IDE_TYPE_FRAME_HEADER); g_type_ensure (IDE_TYPE_FRAME_WRAPPER); g_type_ensure (IDE_TYPE_SHORTCUT_LABEL); }
static void gb_terminal_view_class_init (GbTerminalViewClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); IdeLayoutViewClass *view_class = IDE_LAYOUT_VIEW_CLASS (klass); object_class->finalize = gb_terminal_view_finalize; object_class->get_property = gb_terminal_view_get_property; object_class->set_property = gb_terminal_view_set_property; widget_class->realize = gb_terminal_realize; widget_class->get_preferred_width = gb_terminal_get_preferred_width; widget_class->get_preferred_height = gb_terminal_get_preferred_height; widget_class->grab_focus = gb_terminal_grab_focus; view_class->get_title = gb_terminal_get_title; view_class->create_split = gb_terminal_create_split; view_class->get_split_view = gb_terminal_get_split_view; view_class->set_split_view = gb_terminal_set_split_view; gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/builder/plugins/terminal/gb-terminal-view.ui"); gtk_widget_class_bind_template_child (widget_class, GbTerminalView, terminal_top); gtk_widget_class_bind_template_child (widget_class, GbTerminalView, bottom_container); gtk_widget_class_bind_template_child (widget_class, GbTerminalView, top_scrollbar); gtk_widget_class_bind_template_child (widget_class, GbTerminalView, bottom_scrollbar); g_type_ensure (VTE_TYPE_TERMINAL); properties [PROP_FONT_NAME] = g_param_spec_string ("font-name", "Font Name", "Font Name", NULL, (G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS)); properties [PROP_MANAGE_SPAWN] = g_param_spec_boolean ("manage-spawn", "Manage Spawn", "Manage Spawn", TRUE, (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); properties [PROP_PTY] = g_param_spec_object ("pty", "Pty", "The psuedo terminal to use", VTE_TYPE_PTY, (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); g_object_class_install_properties (object_class, LAST_PROP, properties); g_type_ensure (GB_TYPE_TERMINAL); }
void fu_plugin_init (FuPlugin *plugin) { fu_plugin_set_build_hash (plugin, FU_BUILD_HASH); /* allow these to be built by quirks */ fu_plugin_add_rule (plugin, FU_PLUGIN_RULE_REQUIRES_QUIRK, FU_QUIRKS_PLUGIN); g_type_ensure (FU_TYPE_DELL_DOCK_STATUS); g_type_ensure (FU_TYPE_DELL_DOCK_MST); /* currently slower performance, but more reliable in corner cases */ fu_plugin_add_rule (plugin, FU_PLUGIN_RULE_BETTER_THAN, "synapticsmst"); fu_plugin_add_rule (plugin, FU_PLUGIN_RULE_SUPPORTS_PROTOCOL, "com.dell.dock"); fu_plugin_add_rule (plugin, FU_PLUGIN_RULE_SUPPORTS_PROTOCOL, "com.synaptics.mst"); }
static void gis_language_page_constructed (GObject *object) { GisLanguagePage *page = GIS_LANGUAGE_PAGE (object); GisLanguagePagePrivate *priv = gis_language_page_get_instance_private (page); GDBusConnection *bus; g_type_ensure (CC_TYPE_LANGUAGE_CHOOSER); G_OBJECT_CLASS (gis_language_page_parent_class)->constructed (object); g_signal_connect (priv->language_chooser, "notify::language", G_CALLBACK (language_changed), page); /* If we're in new user mode then we're manipulating system settings */ if (gis_driver_get_mode (GIS_PAGE (page)->driver) == GIS_DRIVER_MODE_NEW_USER) { priv->permission = polkit_permission_new_sync ("org.freedesktop.locale1.set-locale", NULL, NULL, NULL); bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL); g_dbus_proxy_new (bus, G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES, NULL, "org.freedesktop.locale1", "/org/freedesktop/locale1", "org.freedesktop.locale1", priv->cancellable, (GAsyncReadyCallback) localed_proxy_ready, object); g_object_unref (bus); } gis_page_set_complete (GIS_PAGE (page), TRUE); gtk_widget_show (GTK_WIDGET (page)); }
void photos_utils_ensure_builtins (void) { static gsize once_init_value = 0; photos_utils_ensure_extension_points (); if (g_once_init_enter (&once_init_value)) { g_type_ensure (PHOTOS_TYPE_FACEBOOK_ITEM); g_type_ensure (PHOTOS_TYPE_FLICKR_ITEM); g_type_ensure (PHOTOS_TYPE_LOCAL_ITEM); g_once_init_leave (&once_init_value, 1); } }
static void gtk_color_editor_init (GtkColorEditor *editor) { GdkRGBA transparent = { 0, 0, 0, 0 }; editor->priv = G_TYPE_INSTANCE_GET_PRIVATE (editor, GTK_TYPE_COLOR_EDITOR, GtkColorEditorPrivate); editor->priv->use_alpha = TRUE; g_type_ensure (GTK_TYPE_COLOR_SCALE); g_type_ensure (GTK_TYPE_COLOR_PLANE); g_type_ensure (GTK_TYPE_COLOR_SWATCH); gtk_widget_init_template (GTK_WIDGET (editor)); /* Some post processing is needed in code to set this up */ gtk_widget_set_events (editor->priv->swatch, gtk_widget_get_events (editor->priv->swatch) & ~(GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK)); if (gtk_widget_get_direction (editor->priv->h_slider) == GTK_TEXT_DIR_RTL) gtk_style_context_add_class (gtk_widget_get_style_context (editor->priv->h_slider), GTK_STYLE_CLASS_SCALE_HAS_MARKS_ABOVE); else gtk_style_context_add_class (gtk_widget_get_style_context (editor->priv->h_slider), GTK_STYLE_CLASS_SCALE_HAS_MARKS_BELOW); gtk_widget_override_background_color (editor->priv->overlay, 0, &transparent); /* Create the scaled popup adjustments manually here because connecting user data is not * supported by template GtkBuilder xml (it would be possible to set this up in the xml * but require 4 separate callbacks and would be rather ugly). */ gtk_spin_button_set_adjustment (GTK_SPIN_BUTTON (editor->priv->h_entry), scaled_adjustment (editor->priv->h_adj, 100)); gtk_spin_button_set_adjustment (GTK_SPIN_BUTTON (editor->priv->s_entry), scaled_adjustment (editor->priv->s_adj, 100)); gtk_spin_button_set_adjustment (GTK_SPIN_BUTTON (editor->priv->v_entry), scaled_adjustment (editor->priv->v_adj, 100)); gtk_spin_button_set_adjustment (GTK_SPIN_BUTTON (editor->priv->a_entry), scaled_adjustment (editor->priv->a_adj, 100)); /* This can be setup in the .ui file, but requires work in Glade otherwise it cannot be edited there */ gtk_overlay_add_overlay (GTK_OVERLAY (editor->priv->overlay), editor->priv->sv_popup); gtk_overlay_add_overlay (GTK_OVERLAY (editor->priv->overlay), editor->priv->h_popup); gtk_overlay_add_overlay (GTK_OVERLAY (editor->priv->overlay), editor->priv->a_popup); }
static void gb_editor_view_class_init (GbEditorViewClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GbViewClass *view_class = GB_VIEW_CLASS (klass); object_class->constructed = gb_editor_view_constructed; object_class->finalize = gb_editor_view_finalize; object_class->get_property = gb_editor_view_get_property; object_class->set_property = gb_editor_view_set_property; widget_class->grab_focus = gb_editor_view_grab_focus; widget_class->get_request_mode = gb_editor_view_get_request_mode; widget_class->get_preferred_height = gb_editor_view_get_preferred_height; view_class->create_split = gb_editor_view_create_split; view_class->get_document = gb_editor_view_get_document; view_class->get_modified = gb_editor_view_get_modified; view_class->set_split_view = gb_editor_view_set_split_view; view_class->set_back_forward_list = gb_editor_view_set_back_forward_list; view_class->navigate_to = gb_editor_view_navigate_to; gParamSpecs [PROP_DOCUMENT] = g_param_spec_object ("document", _("Document"), _("The editor document."), GB_TYPE_EDITOR_DOCUMENT, (G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); g_object_class_install_properties (object_class, LAST_PROP, gParamSpecs); GB_WIDGET_CLASS_TEMPLATE (klass, "gb-editor-view.ui"); GB_WIDGET_CLASS_BIND (klass, GbEditorView, frame1); GB_WIDGET_CLASS_BIND (klass, GbEditorView, modified_cancel_button); GB_WIDGET_CLASS_BIND (klass, GbEditorView, modified_revealer); GB_WIDGET_CLASS_BIND (klass, GbEditorView, paned); GB_WIDGET_CLASS_BIND (klass, GbEditorView, progress_bar); GB_WIDGET_CLASS_BIND (klass, GbEditorView, tweak_button); GB_WIDGET_CLASS_BIND (klass, GbEditorView, tweak_widget); g_type_ensure (GB_TYPE_EDITOR_FRAME); g_type_ensure (GB_TYPE_EDITOR_TWEAK_WIDGET); }
static void eog_preferences_dialog_class_init (EogPreferencesDialogClass *klass) { GtkWidgetClass *widget_class = (GtkWidgetClass*) klass; /* This should make sure the libpeas-gtk dependency isn't * dropped by aggressive linkers (#739618) */ g_type_ensure (PEAS_GTK_TYPE_PLUGIN_MANAGER); gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/eog/ui/eog-preferences-dialog.ui"); gtk_widget_class_bind_template_child_private (widget_class, EogPreferencesDialog, interpolate_check); gtk_widget_class_bind_template_child_private (widget_class, EogPreferencesDialog, extrapolate_check); gtk_widget_class_bind_template_child_private (widget_class, EogPreferencesDialog, autorotate_check); gtk_widget_class_bind_template_child_private (widget_class, EogPreferencesDialog, bg_color_check); gtk_widget_class_bind_template_child_private (widget_class, EogPreferencesDialog, bg_color_button); gtk_widget_class_bind_template_child_private (widget_class, EogPreferencesDialog, color_radio); gtk_widget_class_bind_template_child_private (widget_class, EogPreferencesDialog, checkpattern_radio); gtk_widget_class_bind_template_child_private (widget_class, EogPreferencesDialog, background_radio); gtk_widget_class_bind_template_child_private (widget_class, EogPreferencesDialog, transp_color_button); gtk_widget_class_bind_template_child_private (widget_class, EogPreferencesDialog, upscale_check); gtk_widget_class_bind_template_child_private (widget_class, EogPreferencesDialog, loop_check); gtk_widget_class_bind_template_child_private (widget_class, EogPreferencesDialog, seconds_scale); gtk_widget_class_bind_template_child_private (widget_class, EogPreferencesDialog, plugin_manager); }
static void gb_shortcuts_dialog_class_init (GbShortcutsDialogClass *klass) { GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass); GtkBindingSet *binding_set = gtk_binding_set_by_class (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->constructed = gb_shortcuts_dialog_constructed; object_class->finalize = gb_shortcuts_dialog_finalize; object_class->get_property = gb_shortcuts_dialog_get_property; object_class->set_property = gb_shortcuts_dialog_set_property; container_class->add = gb_shortcuts_dialog_add; klass->close = gb_shortcuts_dialog_real_close; properties [PROP_VIEW_NAME] = g_param_spec_string ("view-name", "ViewName", "ViewName", NULL, (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_properties (object_class, LAST_PROP, properties); signals [CLOSE] = g_signal_new ("close", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GbShortcutsDialogClass, close), NULL, NULL, NULL, G_TYPE_NONE, 0); gtk_binding_entry_add_signal (binding_set, GDK_KEY_Escape, 0, "close", 0); g_type_ensure (GB_TYPE_SHORTCUTS_PAGE); g_type_ensure (GB_TYPE_SHORTCUTS_COLUMN); g_type_ensure (GB_TYPE_SHORTCUTS_GROUP); g_type_ensure (GB_TYPE_SHORTCUTS_GESTURE); g_type_ensure (GB_TYPE_SHORTCUTS_SHORTCUT); }
static void gb_search_box_class_init (GbSearchBoxClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); object_class->constructed = gb_search_box_constructed; object_class->finalize = gb_search_box_finalize; widget_class->grab_focus = gb_search_box_grab_focus; widget_class->map = gb_search_box_map; widget_class->unmap = gb_search_box_unmap; GB_WIDGET_CLASS_TEMPLATE (klass, "gb-search-box.ui"); GB_WIDGET_CLASS_BIND (klass, GbSearchBox, button); GB_WIDGET_CLASS_BIND (klass, GbSearchBox, display); GB_WIDGET_CLASS_BIND (klass, GbSearchBox, entry); GB_WIDGET_CLASS_BIND (klass, GbSearchBox, popover); g_type_ensure (GB_TYPE_SEARCH_DISPLAY); g_type_ensure (GB_TYPE_SCROLLED_WINDOW); }
static void ide_omni_bar_class_init (IdeOmniBarClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); object_class->constructed = ide_omni_bar_constructed; widget_class->destroy = ide_omni_bar_destroy; gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/builder/ui/ide-omni-bar.ui"); gtk_widget_class_set_css_name (widget_class, "omnibar"); gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, branch_box); gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, branch_label); gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, build_button); gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, build_button_shortcut); gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, build_result_diagnostics_image); gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, build_result_mode_label); gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, cancel_button); gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, config_name_label); gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, event_box); gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, message_stack); gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, pausables); gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, popover); gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, popover_branch_label); gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, popover_build_message); gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, popover_build_result_label); gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, popover_config_label); gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, popover_details_revealer); gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, popover_errors_label); gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, popover_last_build_time_label); gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, popover_project_label); gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, popover_runtime_label); gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, popover_warnings_label); gtk_widget_class_bind_template_child (widget_class, IdeOmniBar, project_label); g_type_ensure (IDE_TYPE_OMNI_PAUSABLE_ROW); g_type_ensure (DZL_TYPE_LIST_BOX); }
static void cursor_example_init (CursorExample *example) { CursorExamplePrivate *priv; gint i; example->priv = priv = cursor_example_get_instance_private (example); g_type_ensure (CURSOR_TYPE_NAVIGATOR); g_type_ensure (CURSOR_TYPE_SEARCH); gtk_widget_init_template (GTK_WIDGET (example)); for (i = 0; i < N_SLOTS; i++) { gchar *name = g_strdup_printf ("contact_slot_%d", i + 1); priv->slots[i] = (GtkWidget *) gtk_widget_get_template_child (GTK_WIDGET (example), CURSOR_TYPE_EXAMPLE, name); g_free (name); } }
static void ide_editor_perspective_class_init (IdeEditorPerspectiveClass *klass) { GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass); DzlDockBinClass *dock_bin_class = DZL_DOCK_BIN_CLASS (klass); widget_class->destroy = ide_editor_perspective_destroy; widget_class->hierarchy_changed = ide_editor_perspective_hierarchy_changed; widget_class->grab_focus = ide_editor_perspective_grab_focus; container_class->add = ide_editor_perspective_add; dock_bin_class->create_edge = ide_editor_perspective_create_edge; gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/builder/ui/ide-editor-perspective.ui"); gtk_widget_class_bind_template_child (widget_class, IdeEditorPerspective, grid); gtk_widget_class_bind_template_child (widget_class, IdeEditorPerspective, overlay); gtk_widget_class_bind_template_child (widget_class, IdeEditorPerspective, properties); g_type_ensure (IDE_TYPE_EDITOR_PROPERTIES); g_type_ensure (IDE_TYPE_EDITOR_SIDEBAR); g_type_ensure (IDE_TYPE_LAYOUT_GRID); }
/* This function is referred to in gtk/glade/gtk-private-widgets.xml * and is used to ensure the private types for use in Glade while * editing UI files that define GTK+'s various composite widget classes. */ void gtk_glade_catalog_init (const gchar *catalog_name) { g_type_ensure (GTK_TYPE_PATH_BAR); g_type_ensure (GTK_TYPE_COLOR_SWATCH); g_type_ensure (GTK_TYPE_COLOR_PLANE); g_type_ensure (GTK_TYPE_COLOR_SCALE); g_type_ensure (_gtk_scale_button_scale_get_type ()); g_type_ensure (_shortcuts_pane_model_filter_get_type ()); #ifdef G_OS_UNIX g_type_ensure (GTK_TYPE_PRINTER_OPTION_WIDGET); #endif }
static void gb_terminal_view_class_init (GbTerminalViewClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GbViewClass *view_class = GB_VIEW_CLASS (klass); object_class->finalize = gb_terminal_view_finalize; object_class->get_property = gb_terminal_view_get_property; object_class->set_property = gb_terminal_view_set_property; widget_class->realize = gb_terminal_realize; widget_class->get_preferred_width = gb_terminal_get_preferred_width; widget_class->get_preferred_height = gb_terminal_get_preferred_height; widget_class->grab_focus = gb_terminal_grab_focus; view_class->get_title = gb_terminal_get_title; view_class->get_document = gb_terminal_view_get_document; view_class->create_split = gb_terminal_create_split; view_class->set_split_view = gb_terminal_set_split_view; gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/builder/plugins/terminal/gb-terminal-view.ui"); gtk_widget_class_bind_template_child (widget_class, GbTerminalView, terminal_top); gtk_widget_class_bind_template_child (widget_class, GbTerminalView, scrolled_window_bottom); g_type_ensure (VTE_TYPE_TERMINAL); properties [PROP_DOCUMENT] = g_param_spec_object ("document", "Document", "The document for the VTE terminal view.", GB_TYPE_TERMINAL_DOCUMENT, (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); properties [PROP_FONT_NAME] = g_param_spec_string ("font-name", "Font Name", "Font Name", NULL, (G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS)); g_object_class_install_properties (object_class, LAST_PROP, properties); }
GtkWidget * create_widget_factory_content (void) { GError *error = NULL; GtkBuilder *builder; GtkWidget *result; g_type_ensure (my_text_view_get_type ()); builder = gtk_builder_new (); gtk_builder_add_from_file (builder, "../demos/widget-factory/widget-factory.ui", &error); if (error != NULL) g_error ("Failed to create widgets: %s", error->message); result = GTK_WIDGET (gtk_builder_get_object (builder, "box1")); g_object_ref (result); gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (result)), result); g_object_unref (builder); return result; }
int main (gint argc, gchar *argv[]) { int i; if (argc == 1) { g_print ("Usage: gio-querymodules <directory1> [<directory2> ...]\n"); g_print ("Will update giomodule.cache in the listed directories\n"); return 1; } setlocale (LC_ALL, ""); /* Be defensive and ensure we're linked to GObject */ g_type_ensure (G_TYPE_OBJECT); for (i = 1; i < argc; i++) query_dir (argv[i]); return 0; }
void gtk_inspector_init (void) { static GIOExtensionPoint *extension_point = NULL; g_type_ensure (G_TYPE_LIST_STORE); g_type_ensure (GTK_TYPE_CELL_RENDERER_GRAPH); g_type_ensure (GTK_TYPE_GRAPH_DATA); g_type_ensure (GTK_TYPE_INSPECTOR_ACTIONS); g_type_ensure (GTK_TYPE_INSPECTOR_CSS_EDITOR); g_type_ensure (GTK_TYPE_INSPECTOR_CSS_NODE_TREE); g_type_ensure (GTK_TYPE_INSPECTOR_DATA_LIST); g_type_ensure (GTK_TYPE_INSPECTOR_GENERAL); g_type_ensure (GTK_TYPE_INSPECTOR_GESTURES); g_type_ensure (GTK_TYPE_MAGNIFIER); g_type_ensure (GTK_TYPE_INSPECTOR_MAGNIFIER); g_type_ensure (GTK_TYPE_INSPECTOR_MENU); g_type_ensure (GTK_TYPE_INSPECTOR_MISC_INFO); g_type_ensure (GTK_TYPE_INSPECTOR_OBJECT_HIERARCHY); g_type_ensure (GTK_TYPE_INSPECTOR_OBJECT_TREE); g_type_ensure (GTK_TYPE_INSPECTOR_PROP_LIST); g_type_ensure (GTK_TYPE_INSPECTOR_RECORDER); g_type_ensure (GTK_TYPE_INSPECTOR_RESOURCE_LIST); g_type_ensure (GTK_TYPE_INSPECTOR_SELECTOR); g_type_ensure (GTK_TYPE_INSPECTOR_SIGNALS_LIST); g_type_ensure (GTK_TYPE_INSPECTOR_SIZE_GROUPS); g_type_ensure (GTK_TYPE_INSPECTOR_STATISTICS); g_type_ensure (GTK_TYPE_INSPECTOR_VISUAL); g_type_ensure (GTK_TYPE_INSPECTOR_WINDOW); g_type_ensure (GTK_TYPE_RENDER_NODE_VIEW); g_type_ensure (GTK_TYPE_STACK_COMBO); if (extension_point == NULL) { GIOModuleScope *scope; gchar **paths; int i; extension_point = g_io_extension_point_register ("gtk-inspector-page"); g_io_extension_point_set_required_type (extension_point, GTK_TYPE_WIDGET); paths = _gtk_get_module_path ("inspector"); scope = g_io_module_scope_new (G_IO_MODULE_SCOPE_BLOCK_DUPLICATES); for (i = 0; paths[i] != NULL; i++) g_io_modules_load_all_in_directory_with_scope (paths[i], scope); g_strfreev (paths); g_io_module_scope_free (scope); } }
void photos_utils_ensure_builtins (void) { static gsize once_init_value = 0; photos_utils_ensure_extension_points (); photos_gegl_ensure_builtins (); if (g_once_init_enter (&once_init_value)) { g_type_ensure (PHOTOS_TYPE_DEVICE_ITEM); g_type_ensure (PHOTOS_TYPE_FACEBOOK_ITEM); g_type_ensure (PHOTOS_TYPE_FLICKR_ITEM); g_type_ensure (PHOTOS_TYPE_GOOGLE_ITEM); g_type_ensure (PHOTOS_TYPE_LOCAL_ITEM); g_type_ensure (PHOTOS_TYPE_MEDIA_SERVER_ITEM); g_type_ensure (PHOTOS_TYPE_SHARE_POINT_EMAIL); g_type_ensure (PHOTOS_TYPE_SHARE_POINT_GOOGLE); g_type_ensure (PHOTOS_TYPE_TOOL_COLORS); g_type_ensure (PHOTOS_TYPE_TOOL_CROP); g_type_ensure (PHOTOS_TYPE_TOOL_ENHANCE); g_type_ensure (PHOTOS_TYPE_TOOL_FILTERS); g_type_ensure (PHOTOS_TYPE_TRACKER_COLLECTION_VIEW_CONTROLLER); g_type_ensure (PHOTOS_TYPE_TRACKER_COLLECTIONS_CONTROLLER); g_type_ensure (PHOTOS_TYPE_TRACKER_FAVORITES_CONTROLLER); g_type_ensure (PHOTOS_TYPE_TRACKER_IMPORT_CONTROLLER); g_type_ensure (PHOTOS_TYPE_TRACKER_OVERVIEW_CONTROLLER); g_type_ensure (PHOTOS_TYPE_TRACKER_SEARCH_CONTROLLER); g_once_init_leave (&once_init_value, 1); } }
static void ide_init_ctor (void) { GgitFeatureFlags ggit_flags; g_irepository_prepend_search_path (LIBDIR"/gnome-builder/girepository-1.0"); g_type_ensure (IDE_TYPE_CONTEXT); g_type_ensure (IDE_TYPE_VCS); g_io_extension_point_register (IDE_FILE_SETTINGS_EXTENSION_POINT); g_io_extension_point_register (IDE_SCRIPT_EXTENSION_POINT); g_io_extension_point_register (IDE_VCS_EXTENSION_POINT); g_io_extension_point_implement (IDE_FILE_SETTINGS_EXTENSION_POINT, IDE_TYPE_MODELINES_FILE_SETTINGS, IDE_FILE_SETTINGS_EXTENSION_POINT".modelines", -100); g_io_extension_point_implement (IDE_FILE_SETTINGS_EXTENSION_POINT, IDE_TYPE_EDITORCONFIG_FILE_SETTINGS, IDE_FILE_SETTINGS_EXTENSION_POINT".editorconfig", -200); g_io_extension_point_implement (IDE_FILE_SETTINGS_EXTENSION_POINT, IDE_TYPE_GSETTINGS_FILE_SETTINGS, IDE_FILE_SETTINGS_EXTENSION_POINT".gsettings", -300); #ifdef ENABLE_GJS_SCRIPTING g_io_extension_point_implement (IDE_SCRIPT_EXTENSION_POINT, IDE_TYPE_GJS_SCRIPT, IDE_SCRIPT_EXTENSION_POINT".gjs", -100); #endif #ifdef ENABLE_PYTHON_SCRIPTING g_io_extension_point_implement (IDE_SCRIPT_EXTENSION_POINT, IDE_TYPE_PYGOBJECT_SCRIPT, IDE_SCRIPT_EXTENSION_POINT".py", -100); #endif g_io_extension_point_implement (IDE_VCS_EXTENSION_POINT, IDE_TYPE_GIT_VCS, IDE_VCS_EXTENSION_POINT".git", -100); g_io_extension_point_implement (IDE_VCS_EXTENSION_POINT, IDE_TYPE_DIRECTORY_VCS, IDE_VCS_EXTENSION_POINT".directory", -200); modeline_parser_init (); ggit_init (); ggit_flags = ggit_get_features (); if ((ggit_flags & GGIT_FEATURE_THREADS) == 0) { g_error (_("Builder requires libgit2-glib with threading support.")); exit (EXIT_FAILURE); } if ((ggit_flags & GGIT_FEATURE_SSH) == 0) { g_error (_("Builder requires libgit2-glib with SSH support.")); exit (EXIT_FAILURE); } _ide_thread_pool_init (); _ide_battery_monitor_init (); }
gint main (gint argc, gchar **argv) { GOptionContext *context; EDBusServer *server; EDBusServerExitCode exit_code; GError *error = NULL; #ifdef G_OS_WIN32 e_util_win32_initialize (); #endif setlocale (LC_ALL, ""); bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); /* Workaround https://bugzilla.gnome.org/show_bug.cgi?id=674885 */ g_type_ensure (G_TYPE_DBUS_CONNECTION); #if defined (ENABLE_MAINTAINER_MODE) && defined (HAVE_GTK) if (g_getenv ("EDS_TESTING") == NULL) /* This is only to load gtk-modules, like * bug-buddy's gnomesegvhandler, if possible */ gtk_init_check (&argc, &argv); #endif context = g_option_context_new (NULL); g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE); g_option_context_parse (context, &argc, &argv, &error); g_option_context_free (context); if (error != NULL) { g_printerr ("%s\n", error->message); exit (EXIT_FAILURE); } e_gdbus_templates_init_main_thread (); reload: server = e_data_book_factory_new (NULL, &error); if (error != NULL) { g_printerr ("%s\n", error->message); exit (EXIT_FAILURE); } g_debug ("Server is up and running..."); /* This SHOULD keep the server's use * count from ever reaching zero. */ if (opt_keep_running) e_dbus_server_hold (server); exit_code = e_dbus_server_run (server, opt_wait_for_client); g_object_unref (server); if (exit_code == E_DBUS_SERVER_EXIT_RELOAD) { g_debug ("Reloading..."); goto reload; } g_debug ("Bye."); return 0; }
static void ide_editor_frame_class_init (IdeEditorFrameClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); object_class->constructed = ide_editor_frame_constructed; object_class->dispose = ide_editor_frame_dispose; object_class->get_property = ide_editor_frame_get_property; object_class->set_property = ide_editor_frame_set_property; widget_class->destroy = ide_editor_frame_destroy; widget_class->grab_focus = ide_editor_frame_grab_focus; properties [PROP_AUTO_HIDE_MAP] = g_param_spec_boolean ("auto-hide-map", "Auto Hide Map", "Auto Hide Map", FALSE, (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); properties [PROP_BACK_FORWARD_LIST] = g_param_spec_object ("back-forward-list", "Back Forward List", "The back forward list.", IDE_TYPE_BACK_FORWARD_LIST, (G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS)); properties [PROP_DOCUMENT] = g_param_spec_object ("document", "Document", "The editor document.", IDE_TYPE_BUFFER, (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); properties [PROP_SHOW_MAP] = g_param_spec_boolean ("show-map", "Show Map", "If the overview map should be shown.", FALSE, (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); properties [PROP_SHOW_RULER] = g_param_spec_boolean ("show-ruler", "Show Ruler", "If the ruler should always be shown.", FALSE, (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_properties (object_class, LAST_PROP, properties); gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/builder/ui/ide-editor-frame.ui"); gtk_widget_class_bind_template_child (widget_class, IdeEditorFrame, floating_bar); gtk_widget_class_bind_template_child (widget_class, IdeEditorFrame, map_revealer); gtk_widget_class_bind_template_child (widget_class, IdeEditorFrame, mode_name_label); gtk_widget_class_bind_template_child (widget_class, IdeEditorFrame, overwrite_label); gtk_widget_class_bind_template_child (widget_class, IdeEditorFrame, scrolled_window); gtk_widget_class_bind_template_child (widget_class, IdeEditorFrame, search_frame); gtk_widget_class_bind_template_child (widget_class, IdeEditorFrame, search_entry); gtk_widget_class_bind_template_child (widget_class, IdeEditorFrame, replace_entry); gtk_widget_class_bind_template_child (widget_class, IdeEditorFrame, replace_button); gtk_widget_class_bind_template_child (widget_class, IdeEditorFrame, replace_all_button); gtk_widget_class_bind_template_child (widget_class, IdeEditorFrame, search_options); gtk_widget_class_bind_template_child (widget_class, IdeEditorFrame, search_revealer); gtk_widget_class_bind_template_child (widget_class, IdeEditorFrame, source_map_container); gtk_widget_class_bind_template_child (widget_class, IdeEditorFrame, source_overlay); gtk_widget_class_bind_template_child (widget_class, IdeEditorFrame, source_view); g_type_ensure (NAUTILUS_TYPE_FLOATING_BAR); g_type_ensure (GD_TYPE_TAGGED_ENTRY); }
static void gtk_shortcuts_window_class_init (GtkShortcutsWindowClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass); GtkBindingSet *binding_set = gtk_binding_set_by_class (klass); object_class->constructed = gtk_shortcuts_window_constructed; object_class->finalize = gtk_shortcuts_window_finalize; object_class->get_property = gtk_shortcuts_window_get_property; object_class->set_property = gtk_shortcuts_window_set_property; object_class->dispose = gtk_shortcuts_window_dispose; widget_class->unmap = gtk_shortcuts_window_unmap; container_class->add = gtk_shortcuts_window_add; container_class->remove = gtk_shortcuts_window_remove; container_class->child_type = gtk_shortcuts_window_child_type; container_class->forall = gtk_shortcuts_window_forall; klass->close = gtk_shortcuts_window_close; klass->search = gtk_shortcuts_window_search; /** * GtkShortcutsWindow:section-name: * * The name of the section to show. * * This should be the section-name of one of the #GtkShortcutsSection * objects that are in this shortcuts window. */ properties[PROP_SECTION_NAME] = g_param_spec_string ("section-name", P_("Section Name"), P_("Section Name"), "internal-search", (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * GtkShortcutsWindow:view-name: * * The view name by which to filter the contents. * * This should correspond to the #GtkShortcutsGroup:view property of some of * the #GtkShortcutsGroup objects that are inside this shortcuts window. * * Set this to %NULL to show all groups. */ properties[PROP_VIEW_NAME] = g_param_spec_string ("view-name", P_("View Name"), P_("View Name"), NULL, (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_properties (object_class, LAST_PROP, properties); /** * GtkShortcutsWindow::close: * * The ::close signal is a * [keybinding signal][GtkBindingSignal] * which gets emitted when the user uses a keybinding to close * the window. * * The default binding for this signal is the Escape key. */ signals[CLOSE] = g_signal_new (I_("close"), G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GtkShortcutsWindowClass, close), NULL, NULL, NULL, G_TYPE_NONE, 0); /** * GtkShortcutsWindow::search: * * The ::search signal is a * [keybinding signal][GtkBindingSignal] * which gets emitted when the user uses a keybinding to start a search. * * The default binding for this signal is Control-F. */ signals[SEARCH] = g_signal_new (I_("search"), G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GtkShortcutsWindowClass, search), NULL, NULL, NULL, G_TYPE_NONE, 0); gtk_binding_entry_add_signal (binding_set, GDK_KEY_Escape, 0, "close", 0); gtk_binding_entry_add_signal (binding_set, GDK_KEY_f, GDK_CONTROL_MASK, "search", 0); g_type_ensure (GTK_TYPE_SHORTCUTS_GROUP); g_type_ensure (GTK_TYPE_SHORTCUTS_SHORTCUT); }
gint main (gint argc, gchar **argv) { EShell *shell; GSettings *settings; #ifdef DEVELOPMENT gboolean skip_warning_dialog; #endif GError *error = NULL; #ifdef G_OS_WIN32 gchar *path; /* Reduce risks */ { typedef BOOL (WINAPI *t_SetDllDirectoryA) (LPCSTR lpPathName); t_SetDllDirectoryA p_SetDllDirectoryA; p_SetDllDirectoryA = GetProcAddress ( GetModuleHandle ("kernel32.dll"), "SetDllDirectoryA"); if (p_SetDllDirectoryA) (*p_SetDllDirectoryA) (""); } #ifndef _WIN64 { typedef BOOL (WINAPI *t_SetProcessDEPPolicy) (DWORD dwFlags); t_SetProcessDEPPolicy p_SetProcessDEPPolicy; p_SetProcessDEPPolicy = GetProcAddress ( GetModuleHandle ("kernel32.dll"), "SetProcessDEPPolicy"); if (p_SetProcessDEPPolicy) (*p_SetProcessDEPPolicy) ( PROCESS_DEP_ENABLE | PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION); } #endif if (fileno (stdout) != -1 && _get_osfhandle (fileno (stdout)) != -1) { /* stdout is fine, presumably redirected to a file or pipe */ } else { typedef BOOL (* WINAPI AttachConsole_t) (DWORD); AttachConsole_t p_AttachConsole = (AttachConsole_t) GetProcAddress ( GetModuleHandle ("kernel32.dll"), "AttachConsole"); if (p_AttachConsole && p_AttachConsole (ATTACH_PARENT_PROCESS)) { freopen ("CONOUT$", "w", stdout); dup2 (fileno (stdout), 1); freopen ("CONOUT$", "w", stderr); dup2 (fileno (stderr), 2); } } #endif /* Make ElectricFence work. */ free (malloc (10)); bindtextdomain (GETTEXT_PACKAGE, EVOLUTION_LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); /* do not require Gtk+ for --force-shutdown */ if (argc == 2 && argv[1] && g_str_equal (argv[1], "--force-shutdown")) { shell_force_shutdown (); return 0; } /* The contact maps feature uses clutter-gtk. */ #ifdef WITH_CONTACT_MAPS /* XXX This function is declared in gtk-clutter-util.h with an * unnecessary G_GNUC_WARN_UNUSED_RESULT attribute. But we * don't need the returned error code because we're checking * the GError directly. Just ignore this warning. */ gtk_clutter_init_with_args ( &argc, &argv, _("- The Evolution PIM and Email Client"), entries, (gchar *) GETTEXT_PACKAGE, &error); #else gtk_init_with_args ( &argc, &argv, _("- The Evolution PIM and Email Client"), entries, (gchar *) GETTEXT_PACKAGE, &error); #endif /* WITH_CONTACT_MAPS */ if (error != NULL) { g_printerr ("%s\n", error->message); g_error_free (error); exit (1); } #ifdef HAVE_ICAL_UNKNOWN_TOKEN_HANDLING ical_set_unknown_token_handling_setting (ICAL_DISCARD_TOKEN); #endif e_gdbus_templates_init_main_thread (); #ifdef G_OS_WIN32 path = g_build_path (";", _e_get_bindir (), g_getenv ("PATH"), NULL); if (!g_setenv ("PATH", path, TRUE)) g_warning ("Could not set PATH for Evolution and its child processes"); g_free (path); if (register_handlers || reinstall || show_icons) { _e_win32_register_mailer (); _e_win32_register_addressbook (); } if (register_handlers) exit (0); if (reinstall) { _e_win32_set_default_mailer (); exit (0); } if (show_icons) { _e_win32_set_default_mailer (); exit (0); } if (hide_icons) { _e_win32_unset_default_mailer (); exit (0); } if (unregister_handlers) { _e_win32_unregister_mailer (); _e_win32_unregister_addressbook (); exit (0); } if (strcmp (gettext (""), "") == 0) { /* No message catalog installed for the current locale * language, so don't bother with the localisations * provided by other things then either. Reset thread * locale to "en-US" and C library locale to "C". */ SetThreadLocale ( MAKELCID (MAKELANGID (LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)); setlocale (LC_ALL, "C"); } #endif if (start_online && start_offline) { g_printerr ( _("%s: --online and --offline cannot be used " "together.\n Run '%s --help' for more " "information.\n"), argv[0], argv[0]); exit (1); } else if (force_online && start_offline) { g_printerr ( _("%s: --force-online and --offline cannot be used " "together.\n Run '%s --help' for more " "information.\n"), argv[0], argv[0]); exit (1); } if (force_shutdown) shell_force_shutdown (); if (disable_preview) { settings = g_settings_new ("org.gnome.evolution.mail"); g_settings_set_boolean (settings, "safe-list", TRUE); g_object_unref (settings); settings = g_settings_new ("org.gnome.evolution.addressbook"); g_settings_set_boolean (settings, "show-preview", FALSE); g_object_unref (settings); settings = g_settings_new ("org.gnome.evolution.calendar"); g_settings_set_boolean (settings, "show-memo-preview", FALSE); g_settings_set_boolean (settings, "show-task-preview", FALSE); g_object_unref (settings); } #ifdef G_OS_UNIX g_unix_signal_add_full ( G_PRIORITY_DEFAULT, SIGTERM, handle_term_signal, NULL, NULL); #endif e_passwords_init (); gtk_window_set_default_icon_name ("evolution"); if (setup_only) exit (0); categories_icon_theme_hack (); gtk_accel_map_load (e_get_accels_filename ()); #ifdef DEVELOPMENT settings = g_settings_new ("org.gnome.evolution.shell"); skip_warning_dialog = g_settings_get_boolean ( settings, "skip-warning-dialog"); if (!skip_warning_dialog && !getenv ("EVOLVE_ME_HARDER")) g_settings_set_boolean ( settings, "skip-warning-dialog", show_development_warning ()); g_object_unref (settings); #endif /* Workaround https://bugzilla.gnome.org/show_bug.cgi?id=683548 */ if (!quit) g_type_ensure (WEBKIT_TYPE_WEB_VIEW); shell = create_default_shell (); if (!shell) return 1; if (quit) { e_shell_quit (shell, E_SHELL_QUIT_OPTION); goto exit; } /* This routine converts the local mail store from mbox format to * Maildir format as needed. The reason the code is here and not * in the mail module is because we inform the user at startup of * the impending mail conversion by displaying a popup dialog and * waiting for confirmation before proceeding. * * This has to be done before we load modules because some of the * EShellBackends immediately add GMainContext sources that would * otherwise get dispatched during gtk_dialog_run(), and we don't * want them dispatched until after the conversion is complete. * * Addendum: We need to perform the XDG Base Directory migration * before converting the local mail store, because the * conversion is triggered by checking for certain key * files and directories under XDG_DATA_HOME. Without * this the mail conversion will not trigger for users * upgrading from Evolution 2.30 or older. */ e_migrate_base_dirs (shell); e_convert_local_mail (shell); e_shell_load_modules (shell); if (!disable_eplugin) { /* Register built-in plugin hook types. */ g_type_ensure (E_TYPE_IMPORT_HOOK); g_type_ensure (E_TYPE_PLUGIN_UI_HOOK); /* All EPlugin and EPluginHook subclasses should be * registered in GType now, so load plugins now. */ e_plugin_load_plugins (); } /* Attempt migration -after- loading all modules and plugins, * as both shell backends and certain plugins hook into this. */ e_shell_migrate_attempt (shell); e_shell_event (shell, "ready-to-start", NULL); g_idle_add ((GSourceFunc) idle_cb, remaining_args); gtk_main (); exit: /* Drop what should be the last reference to the shell. * That will cause e_shell_get_default() to henceforth * return NULL. Use that to check for reference leaks. */ g_object_unref (shell); if (e_shell_get_default () != NULL) g_warning ("Shell not finalized on exit"); gtk_accel_map_save (e_get_accels_filename ()); return 0; }
/* * main * */ int main (int argc, char *argv[]) { gboolean wifi_enabled = TRUE, net_enabled = TRUE, wwan_enabled = TRUE; gboolean success = FALSE; NMConfig *config; GError *error = NULL; gboolean wrote_pidfile = FALSE; char *bad_domains = NULL; NMConfigCmdLineOptions *config_cli; nm_g_type_init (); /* Known to cause a possible deadlock upon GDBus initialization: * https://bugzilla.gnome.org/show_bug.cgi?id=674885 */ g_type_ensure (G_TYPE_SOCKET); g_type_ensure (G_TYPE_DBUS_CONNECTION); g_type_ensure (NM_TYPE_BUS_MANAGER); _nm_utils_is_manager_process = TRUE; main_loop = g_main_loop_new (NULL, FALSE); config_cli = nm_config_cmd_line_options_new (); do_early_setup (&argc, &argv, config_cli); if (global_opt.g_fatal_warnings) _set_g_fatal_warnings (); if (global_opt.show_version) { fprintf (stdout, NM_DIST_VERSION "\n"); exit (0); } nm_main_utils_ensure_root (); nm_main_utils_ensure_not_running_pidfile (global_opt.pidfile); /* Ensure state directory exists */ if (g_mkdir_with_parents (NMSTATEDIR, 0755) != 0) { fprintf (stderr, "Cannot create '%s': %s", NMSTATEDIR, strerror (errno)); exit (1); } nm_main_utils_ensure_rundir (); /* When running from the build directory, determine our build directory * base and set helper paths in the build tree */ if (global_opt.run_from_build_dir) { char *path, *slash; int g; /* exe is <basedir>/src/.libs/lt-NetworkManager, so chop off * the last three components */ path = realpath ("/proc/self/exe", NULL); g_assert (path != NULL); for (g = 0; g < 3; ++g) { slash = strrchr (path, '/'); g_assert (slash != NULL); *slash = '\0'; } /* don't free these strings, we need them for the entire * process lifetime */ nm_dhcp_helper_path = g_strdup_printf ("%s/src/dhcp-manager/nm-dhcp-helper", path); g_free (path); } if (!nm_logging_setup (global_opt.opt_log_level, global_opt.opt_log_domains, &bad_domains, &error)) { fprintf (stderr, _("%s. Please use --help to see a list of valid options.\n"), error->message); exit (1); } else if (bad_domains) { fprintf (stderr, _("Ignoring unrecognized log domain(s) '%s' passed on command line.\n"), bad_domains); g_clear_pointer (&bad_domains, g_free); } /* Read the config file and CLI overrides */ config = nm_config_setup (config_cli, NULL, &error); nm_config_cmd_line_options_free (config_cli); config_cli = NULL; if (config == NULL) { fprintf (stderr, _("Failed to read configuration: (%d) %s\n"), error ? error->code : -1, (error && error->message) ? error->message : _("unknown")); exit (1); } _init_nm_debug (nm_config_get_debug (config)); /* Initialize logging from config file *only* if not explicitly * specified by commandline. */ if (global_opt.opt_log_level == NULL && global_opt.opt_log_domains == NULL) { if (!nm_logging_setup (nm_config_get_log_level (config), nm_config_get_log_domains (config), &bad_domains, &error)) { fprintf (stderr, _("Error in configuration file: %s.\n"), error->message); exit (1); } else if (bad_domains) { fprintf (stderr, _("Ignoring unrecognized log domain(s) '%s' from config files.\n"), bad_domains); g_clear_pointer (&bad_domains, g_free); } } if (global_opt.become_daemon && !nm_config_get_is_debug (config)) { if (daemon (0, 0) < 0) { int saved_errno; saved_errno = errno; fprintf (stderr, _("Could not daemonize: %s [error %u]\n"), g_strerror (saved_errno), saved_errno); exit (1); } wrote_pidfile = nm_main_utils_write_pidfile (global_opt.pidfile); } /* Set up unix signal handling - before creating threads, but after daemonizing! */ nm_main_utils_setup_signals (main_loop); nm_logging_syslog_openlog (nm_config_get_is_debug (config) ? "debug" : nm_config_data_get_value_cached (NM_CONFIG_GET_DATA_ORIG, NM_CONFIG_KEYFILE_GROUP_LOGGING, NM_CONFIG_KEYFILE_KEY_LOGGING_BACKEND, NM_CONFIG_GET_VALUE_STRIP | NM_CONFIG_GET_VALUE_NO_EMPTY)); nm_log_info (LOGD_CORE, "NetworkManager (version " NM_DIST_VERSION ") is starting..."); /* Parse the state file */ if (!parse_state_file (global_opt.state_file, &net_enabled, &wifi_enabled, &wwan_enabled, &error)) { nm_log_err (LOGD_CORE, "State file %s parsing failed: (%d) %s", global_opt.state_file, error ? error->code : -1, (error && error->message) ? error->message : _("unknown")); /* Not a hard failure */ } g_clear_error (&error); nm_log_info (LOGD_CORE, "Read config: %s", nm_config_data_get_config_description (nm_config_get_data (config))); nm_config_data_log (nm_config_get_data (config), "CONFIG: "); nm_log_dbg (LOGD_CORE, "WEXT support is %s", #if HAVE_WEXT "enabled" #else "disabled" #endif ); nm_auth_manager_setup (nm_config_get_auth_polkit (config)); nm_manager_setup (global_opt.state_file, net_enabled, wifi_enabled, wwan_enabled); if (!nm_bus_manager_get_connection (nm_bus_manager_get ())) { nm_log_warn (LOGD_CORE, "Failed to connect to D-Bus; only private bus is available"); } else { /* Start our DBus service */ if (!nm_bus_manager_start_service (nm_bus_manager_get ())) { nm_log_err (LOGD_CORE, "failed to start the dbus service."); goto done; } } /* Set up platform interaction layer */ nm_linux_platform_setup (); NM_UTILS_KEEP_ALIVE (config, NM_PLATFORM_GET, "NMConfig-depends-on-NMPlatform"); nm_dispatcher_init (); g_signal_connect (nm_manager_get (), NM_MANAGER_CONFIGURE_QUIT, G_CALLBACK (manager_configure_quit), config); if (!nm_manager_start (nm_manager_get (), &error)) { nm_log_err (LOGD_CORE, "failed to initialize: %s", error->message); goto done; } /* Make sure the loopback interface is up. If interface is down, we bring * it up and kernel will assign it link-local IPv4 and IPv6 addresses. If * it was already up, we assume is in clean state. * * TODO: it might be desirable to check the list of addresses and compare * it with a list of expected addresses (one of the protocol families * could be disabled). The 'lo' interface is sometimes used for assigning * global addresses so their availability doesn't depend on the state of * physical interfaces. */ nm_log_dbg (LOGD_CORE, "setting up local loopback"); nm_platform_link_set_up (NM_PLATFORM_GET, 1, NULL); success = TRUE; if (configure_and_quit == FALSE) g_main_loop_run (main_loop); nm_manager_stop (nm_manager_get ()); done: if (global_opt.pidfile && wrote_pidfile) unlink (global_opt.pidfile); nm_log_info (LOGD_CORE, "exiting (%s)", success ? "success" : "error"); exit (success ? 0 : 1); }
gint main (gint argc, gchar **argv) { guint id; guint watched_id; ESubprocessBookFactory *subprocess_book_factory; GMainLoop *loop; GDBusObjectManagerServer *manager; GOptionContext *context; SubprocessData sd; GError *error = NULL; #ifdef G_OS_WIN32 e_util_win32_initialize (); #endif setlocale (LC_ALL, ""); bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); /* Workaround https://bugzilla.gnome.org/show_bug.cgi?id=674885 */ g_type_ensure (G_TYPE_DBUS_CONNECTION); #if defined (ENABLE_MAINTAINER_MODE) && defined (HAVE_GTK) if (g_getenv ("EDS_TESTING") == NULL) /* This is only to load gtk-modules, like * bug-buddy's gnomesegvhandler, if possible */ gtk_init_check (&argc, &argv); #endif context = g_option_context_new (NULL); g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE); g_option_context_parse (context, &argc, &argv, &error); g_option_context_free (context); if (error != NULL) { g_printerr ("%s\n", error->message); exit (EXIT_FAILURE); } loop = g_main_loop_new (NULL, FALSE); manager = g_dbus_object_manager_server_new ("/org/gnome/evolution/dataserver/Subprocess/Backend"); subprocess_book_factory = e_subprocess_book_factory_new (NULL, NULL); sd.loop = loop; sd.manager = manager; sd.subprocess_book_factory = subprocess_book_factory; /* Watch the factory name and close the subprocess if the factory dies/crashes */ watched_id = g_bus_watch_name ( G_BUS_TYPE_SESSION, ADDRESS_BOOK_DBUS_SERVICE_NAME, G_BUS_NAME_WATCHER_FLAGS_NONE, NULL, (GBusNameVanishedCallback) vanished_cb, &sd, NULL); id = g_bus_own_name ( G_BUS_TYPE_SESSION, bus_name, G_BUS_NAME_OWNER_FLAGS_NONE, (GBusAcquiredCallback) on_bus_acquired, NULL, NULL, &sd, NULL); g_main_loop_run (loop); g_bus_unown_name (id); g_bus_unwatch_name (watched_id); g_clear_object (&subprocess_book_factory); g_clear_object (&manager); g_main_loop_unref (loop); return 0; }