コード例 #1
0
ファイル: irc-application.c プロジェクト: TingPing/irc-client
static void
irc_application_load_plugins (IrcApplication *self)
{
	IrcApplicationPrivate *priv = irc_application_get_instance_private (IRC_APPLICATION(self));
	PeasEngine *engine = peas_engine_get_default();
	peas_engine_enable_loader (engine, "python3");
	g_autofree char *custom_path = get_custom_plugin_dir ();
	if (custom_path)
	{
		peas_engine_add_search_path (engine, custom_path, NULL);
	}
	else
	{
		g_autofree char *plugin_path = g_build_filename (LIBDIR, "irc", NULL);
		g_autofree char *user_plugin_path = g_build_filename (g_get_home_dir (), ".local", "lib", "irc", NULL);

		peas_engine_add_search_path (engine, user_plugin_path, NULL);
		peas_engine_add_search_path (engine, plugin_path, NULL);
	}
	priv->extensions = peas_extension_set_new (engine, PEAS_TYPE_ACTIVATABLE,
												"object", self, NULL);

  	g_settings_bind (priv->settings, "enabled-plugins", engine, "loaded-plugins", G_SETTINGS_BIND_DEFAULT);
	peas_extension_set_foreach (priv->extensions, on_extension_added, self);
	g_signal_connect (priv->extensions, "extension-added", G_CALLBACK(on_extension_added), self);
	g_signal_connect (priv->extensions, "extension-removed", G_CALLBACK(on_extension_removed), self);
}
コード例 #2
0
static PeasPluginInfo *
ide_application_locate_tool (IdeApplication *self,
                             const gchar    *tool_name)
{
  PeasEngine *engine;
  const GList *list;

  g_assert (IDE_IS_APPLICATION (self));
  g_assert (tool_name != NULL);

  engine = peas_engine_get_default ();
  list = peas_engine_get_plugin_list (engine);

  for (; list != NULL; list = list->next)
    {
      PeasPluginInfo *plugin_info = list->data;
      const gchar *name;

      name = peas_plugin_info_get_external_data (plugin_info, "Tool-Name");
      if (g_strcmp0 (name, tool_name) == 0)
        return plugin_info;
    }

  return NULL;
}
コード例 #3
0
/**
 * gb_project_init:
 * @project: (in): A #GbProject.
 *
 * Initializes the newly created #GbProject instance.
 */
static void
gb_project_init (GbProject *project)
{
   GbProjectPrivate *priv;
   PeasEngine *engine = peas_engine_get_default();

   ENTRY;

   project->priv = priv =
      G_TYPE_INSTANCE_GET_PRIVATE(project,
                                  GB_TYPE_PROJECT,
                                  GbProjectPrivate);

   priv->targets =
      g_object_new(GB_TYPE_PROJECT_GROUP,
                   "parent", project,
                   "item-type", GB_TYPE_PROJECT_ITEM, // TARGET
                   NULL);

   priv->files =
      g_object_new(GB_TYPE_PROJECT_GROUP,
                   "parent", project,
                   "item-type", GB_TYPE_PROJECT_ITEM, // FILE
                   NULL);

   priv->plugins =
      peas_extension_set_new(engine, GB_TYPE_PROJECT_PLUGIN,
                             "project", project,
                             NULL);

   EXIT;
}
コード例 #4
0
void
ide_application_load_addins (IdeApplication *self)
{
  g_return_if_fail (IDE_IS_APPLICATION (self));

  self->addins = peas_extension_set_new (peas_engine_get_default (),
                                         IDE_TYPE_APPLICATION_ADDIN,
                                         NULL);

  g_signal_connect_object (self->addins,
                           "extension-added",
                           G_CALLBACK (ide_application_addin_added),
                           self,
                           0);

  g_signal_connect_object (self->addins,
                           "extension-removed",
                           G_CALLBACK (ide_application_addin_removed),
                           self,
                           0);

  peas_extension_set_foreach (self->addins,
                              ide_application_addin_added,
                              self);
}
コード例 #5
0
static void
ide_editor_view_load_addins (IdeEditorView *self)
{
  PeasEngine *engine;

  g_assert (IDE_IS_EDITOR_VIEW (self));
  g_assert (self->extensions == NULL);

  engine = peas_engine_get_default ();

  self->extensions = peas_extension_set_new (engine,
                                             IDE_TYPE_EDITOR_VIEW_ADDIN,
                                             NULL);

  g_signal_connect_object (self->extensions,
                           "extension-added",
                           G_CALLBACK (ide_editor_view__extension_added),
                           self,
                           0);

  g_signal_connect_object (self->extensions,
                           "extension-removed",
                           G_CALLBACK (ide_editor_view__extension_removed),
                           self,
                           0);

  peas_extension_set_foreach (self->extensions, ide_editor_view__extension_added, self);
}
コード例 #6
0
ファイル: peas-extension-set.c プロジェクト: kugel-/libpeas
static void
peas_extension_set_constructed (GObject *object)
{
  PeasExtensionSet *set = PEAS_EXTENSION_SET (object);
  GList *plugins, *l;

  if (set->priv->engine == NULL)
    set->priv->engine = peas_engine_get_default ();

  g_object_ref (set->priv->engine);

  plugins = (GList *) peas_engine_get_plugin_list (set->priv->engine);
  for (l = plugins; l; l = l->next)
    add_extension (set, (PeasPluginInfo *) l->data);

  set->priv->load_handler_id =
          g_signal_connect_data (set->priv->engine, "load-plugin",
                                 G_CALLBACK (add_extension), set,
                                 NULL, G_CONNECT_AFTER | G_CONNECT_SWAPPED);
  set->priv->unload_handler_id =
          g_signal_connect_data (set->priv->engine, "unload-plugin",
                                 G_CALLBACK (remove_extension), set,
                                 NULL, G_CONNECT_SWAPPED);

  G_OBJECT_CLASS (peas_extension_set_parent_class)->constructed (object);
}
コード例 #7
0
static void
ide_keybindings_constructed (GObject *object)
{
  IdeKeybindings *self = (IdeKeybindings *)object;
  PeasEngine *engine;
  GdkScreen *screen;

  IDE_ENTRY;

  self->constructed = TRUE;

  G_OBJECT_CLASS (ide_keybindings_parent_class)->constructed (object);

  screen = gdk_screen_get_default ();
  engine = peas_engine_get_default ();

  g_signal_connect_object (engine,
                           "load-plugin",
                           G_CALLBACK (ide_keybindings_load_plugin),
                           self,
                           G_CONNECT_AFTER | G_CONNECT_SWAPPED);

  g_signal_connect_object (engine,
                           "unload-plugin",
                           G_CALLBACK (ide_keybindings_unload_plugin),
                           self,
                           G_CONNECT_SWAPPED);

  gtk_style_context_add_provider_for_screen (screen, GTK_STYLE_PROVIDER (self->css_provider),
                                             GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);

  ide_keybindings_reload (self);

  IDE_EXIT;
}
コード例 #8
0
static PeasPluginInfo *
ide_application_locate_worker (IdeApplication *self,
                               const gchar    *worker_name)
{
  PeasEngine *engine;
  const GList *list;

  g_assert (IDE_IS_APPLICATION (self));
  g_assert (worker_name != NULL);

  engine = peas_engine_get_default ();
  list = peas_engine_get_plugin_list (engine);

  for (; list != NULL; list = list->next)
    {
      PeasPluginInfo *plugin_info = list->data;
      const gchar *name;

      name = peas_plugin_info_get_module_name (plugin_info);
      if (g_strcmp0 (name, worker_name) == 0)
        return plugin_info;
    }

  return NULL;
}
コード例 #9
0
static void
ide_application_plugins_enabled_changed (IdeApplication *self,
                                         const gchar    *key,
                                         GSettings      *settings)
{
  PeasPluginInfo *plugin_info;
  PeasEngine *engine;
  gboolean enabled;

  g_assert (IDE_IS_APPLICATION (self));
  g_assert (dzl_str_equal0 (key, "enabled"));
  g_assert (G_IS_SETTINGS (settings));

  enabled = g_settings_get_boolean (settings, key);

  engine = peas_engine_get_default ();

  plugin_info = g_object_get_data (G_OBJECT (settings), "PEAS_PLUGIN_INFO");
  g_assert (plugin_info != NULL);

  if (enabled &&
      ide_application_can_load_plugin (self, plugin_info) &&
      !peas_plugin_info_is_loaded (plugin_info))
    peas_engine_load_plugin (engine, plugin_info);
  else if (!enabled && peas_plugin_info_is_loaded (plugin_info))
    peas_engine_unload_plugin (engine, plugin_info);
}
コード例 #10
0
ファイル: ide-frame.c プロジェクト: GNOME/gnome-builder
static void
ide_frame_constructed (GObject *object)
{
  IdeFrame *self = (IdeFrame *)object;
  IdeFramePrivate *priv = ide_frame_get_instance_private (self);

  g_assert (IDE_IS_FRAME (self));

  G_OBJECT_CLASS (ide_frame_parent_class)->constructed (object);

  priv->addins = peas_extension_set_new (peas_engine_get_default (),
                                         IDE_TYPE_FRAME_ADDIN,
                                         NULL);

  g_signal_connect (priv->addins,
                    "extension-added",
                    G_CALLBACK (ide_frame_addin_added),
                    self);

  g_signal_connect (priv->addins,
                    "extension-removed",
                    G_CALLBACK (ide_frame_addin_removed),
                    self);

  peas_extension_set_foreach (priv->addins,
                              ide_frame_addin_added,
                              self);

  gtk_widget_add_events (GTK_WIDGET (priv->event_box), GDK_TOUCH_MASK);
  priv->pan = g_object_new (GTK_TYPE_GESTURE_PAN,
                            "widget", priv->event_box,
                            "orientation", GTK_ORIENTATION_HORIZONTAL,
                            "n-points", 3,
                            NULL);
  g_signal_connect_swapped (priv->pan,
                            "begin",
                            G_CALLBACK (ide_frame_pan_begin),
                            self);
  g_signal_connect_swapped (priv->pan,
                            "update",
                            G_CALLBACK (ide_frame_pan_update),
                            self);
  g_signal_connect_swapped (priv->pan,
                            "end",
                            G_CALLBACK (ide_frame_pan_end),
                            self);
  gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (priv->pan),
                                              GTK_PHASE_BUBBLE);

  /*
   * FIXME: Our priv->pan gesture does not activate unless we add another
   *        dummy gesture. I currently have no idea why that is.
   *
   *        https://bugzilla.gnome.org/show_bug.cgi?id=788914
   */
  priv->dummy = gtk_gesture_rotate_new (GTK_WIDGET (priv->event_box));
  gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (priv->dummy),
                                              GTK_PHASE_BUBBLE);
}
コード例 #11
0
ファイル: peas-demo.c プロジェクト: KriG46/libpeas
int
main (int    argc,
      char **argv)
{
    GOptionContext *option_context;
    GError *error = NULL;
    gchar *plugin_dir;
    PeasEngine *engine;

    option_context = g_option_context_new (_("- libpeas demo application"));
    g_option_context_add_main_entries (option_context, demo_args, GETTEXT_PACKAGE);
    g_option_context_add_group (option_context, gtk_get_option_group (TRUE));

    if (!g_option_context_parse (option_context, &argc, &argv, &error))
    {
        g_warning ("Error while parsing arguments: %s", error->message);
        g_error_free (error);
        return -1;
    }

    g_option_context_free (option_context);

    /* Ensure we pick the uninstalled plugin loaders if we're running from build dir */
    if (run_from_build_dir)
    {
        g_debug ("Running from build dir.");
        g_irepository_prepend_search_path ("../libpeas");
        g_irepository_prepend_search_path ("../libpeas-gtk");
        g_setenv ("PEAS_PLUGIN_LOADERS_DIR", "../loaders", TRUE);
    }

    engine = peas_engine_get_default ();
    plugin_dir = g_build_filename (g_get_user_config_dir (), "peas-demo/plugins", NULL);
    peas_engine_add_search_path (engine, plugin_dir, plugin_dir);
    g_free (plugin_dir);

    peas_engine_enable_loader (engine, "gjs");
    peas_engine_enable_loader (engine, "python3");
    peas_engine_enable_loader (engine, "seed");

    if (run_from_build_dir)
        peas_engine_add_search_path (engine, "./plugins", NULL);
    else
        peas_engine_add_search_path (engine,
                                     PEAS_LIBDIR "/peas-demo/plugins/",
                                     PEAS_PREFIX "/share/peas-demo/plugins");

    n_windows = 0;
    main_window = create_main_window ();
    gtk_widget_show_all (main_window);

    gtk_main ();

    gtk_widget_destroy (main_window);

    g_object_unref (engine);

    return 0;
}
コード例 #12
0
static void consort_shell_init (ConsortShell *object) {
    ConsortShellPrivate *priv = CONSORT_SHELL_GET_PRIVATE (object);
    struct desktop *desktop;

    /* Set up the PeasEngine */
    priv->engine = peas_engine_get_default ();
    priv->extensions = peas_extension_set_new (peas_engine_get_default (), PEAS_TYPE_ACTIVATABLE, "object", object, NULL);
    peas_engine_add_search_path (priv->engine, CONSORT_SHELL_PLUGIN_DATA_DIR, CONSORT_SHELL_PLUGIN_DIR);
    peas_engine_enable_loader (priv->engine, "python3");
    
    /* Plugin manager */
    priv->plugin_manager = peas_gtk_plugin_manager_new (priv->engine);
    priv->plugin_window = plugin_window_create (priv);
    gtk_window_set_title (priv->plugin_window, "Consort2 Plugin Manager");
    gtk_widget_show_all (priv->plugin_window);
    
    /* Preload any plugins */
    peas_extension_set_foreach (priv->extensions, (PeasExtensionSetForeachFunc) on_extension_added, object);

    g_signal_connect (priv->extensions, "extension-added", G_CALLBACK (on_extension_added), object);
    g_signal_connect (priv->extensions, "extension-removed", G_CALLBACK (on_extension_removed), object);
    
    desktop = malloc(sizeof *desktop);
    desktop->output = NULL;
    desktop->shell = NULL;

    desktop->gdk_display = gdk_display_get_default();
    desktop->display =
        gdk_wayland_display_get_wl_display(desktop->gdk_display);
    if (desktop->display == NULL) {
        fprintf(stderr, "failed to get display: %m\n");
        return -1;
    }

    desktop->registry = wl_display_get_registry(desktop->display);
    wl_registry_add_listener(desktop->registry,
            &registry_listener, desktop);

    /* Wait until we have been notified about the compositor and shell
     * objects */
    while (!desktop->output || !desktop->shell)
        wl_display_roundtrip (desktop->display);
        
    priv->desktop = desktop;
}
コード例 #13
0
ファイル: ide-workbench.c プロジェクト: gnunn1/gnome-builder
void
ide_workbench_set_context (IdeWorkbench *self,
                           IdeContext   *context)
{
  g_autoptr(GSettings) settings = NULL;
  IdeProject *project;
  guint duration;

  g_return_if_fail (IDE_IS_WORKBENCH (self));
  g_return_if_fail (IDE_IS_CONTEXT (context));
  g_return_if_fail (self->context == NULL);

  settings = g_settings_new ("org.gnome.builder");

  g_set_object (&self->context, context);

  project = ide_context_get_project (context);
  g_object_bind_property_full (project, "name",
                               self, "title",
                               G_BINDING_SYNC_CREATE,
                               transform_title, NULL, NULL, NULL);

  self->addins = peas_extension_set_new (peas_engine_get_default (),
                                         IDE_TYPE_WORKBENCH_ADDIN,
                                         NULL);

  g_signal_connect (self->addins,
                    "extension-added",
                    G_CALLBACK (ide_workbench_addin_added),
                    self);

  g_signal_connect (self->addins,
                    "extension-removed",
                    G_CALLBACK (ide_workbench_addin_removed),
                    self);

  peas_extension_set_foreach (self->addins, ide_workbench_addin_added, self);

  /*
   * Creating all the addins above is a bit intenstive, so give ourselves
   * just a bit of time to stablize allocations and sizing before
   * transitioning to the editor.
   */
  g_timeout_add (STABLIZE_DELAY_MSEC, stablize_cb, g_object_ref (self));

  /*
   * When restoring, previous buffers may get loaded. This causes new
   * widgets to be created and added to the workspace. Doing so during
   * the stack transition results in non-smooth transitions. So instead,
   * we will delay until the transition has completed.
   */
  if (g_settings_get_boolean (settings, "restore-previous-files"))
    {
      duration = gtk_stack_get_transition_duration (self->top_stack);
      g_timeout_add (STABLIZE_DELAY_MSEC + duration, restore_in_timeout, g_object_ref (context));
    }
}
コード例 #14
0
void
ide_application_load_plugins (IdeApplication *self)
{
  PeasEngine *engine;
  const GList *list;

  g_return_if_fail (IDE_IS_APPLICATION (self));

  engine = peas_engine_get_default ();

  list = peas_engine_get_plugin_list (engine);

  for (; list; list = list->next)
    {
      PeasPluginInfo *plugin_info = list->data;
      GSettings *settings;
      const gchar *module_name;

      module_name = peas_plugin_info_get_module_name (plugin_info);
      settings = _ide_application_plugin_get_settings (self, module_name);

      g_object_set_data (G_OBJECT (settings), "PEAS_PLUGIN_INFO", plugin_info);

      g_signal_connect_object (settings,
                               "changed::enabled",
                               G_CALLBACK (ide_application_plugins_enabled_changed),
                               self,
                               G_CONNECT_SWAPPED);

      if (!g_settings_get_boolean (settings, "enabled"))
        continue;

      /*
       * If we are running the unit tests, we don't want to load plugins here,
       * but defer until the test is loading to perform the loading.  However,
       * we do want all of the other machinery above to be setup.
       */
      if (self->mode == IDE_APPLICATION_MODE_TESTS)
        continue;

      if (ide_application_can_load_plugin (self, plugin_info))
        {
          g_debug ("Loading plugin \"%s\"",
                   peas_plugin_info_get_module_name (plugin_info));
          peas_engine_load_plugin (engine, plugin_info);
        }
    }
}
コード例 #15
0
static gchar *
ide_application_get_command_help (IdeApplication *self,
                                  gboolean        long_form)
{
  PeasEngine *engine;
  const GList *list;
  GString *str;
  gint count = 0;

  g_assert (IDE_IS_APPLICATION (self));

  engine = peas_engine_get_default ();
  list = peas_engine_get_plugin_list (engine);

  str = g_string_new (NULL);

  if (long_form)
    g_string_append_printf (str, "%s\n", _("Commands:"));

  for (; list != NULL; list = list->next)
    {
      PeasPluginInfo *plugin_info = list->data;
      const gchar *name;
      const gchar *desc;

      name = peas_plugin_info_get_external_data (plugin_info, "Tool-Name");
      desc = peas_plugin_info_get_external_data (plugin_info, "Tool-Description");

      if (name != NULL)
        {
          if (long_form)
            g_string_append_printf (str, "  %-25s %s\n", name, desc);
          else
            g_string_append_printf (str, "%s\n", name);

          count++;
        }
    }

  if (count == 0)
    {
      g_string_free (str, TRUE);
      return NULL;
    }

  return g_strstrip (g_string_free (str, FALSE));
}
コード例 #16
0
static void
ide_primary_workspace_actions_update_dependencies (GSimpleAction *action,
                                                   GVariant      *param,
                                                   gpointer       user_data)
{
  IdePrimaryWorkspace *self = user_data;
  g_autoptr(PeasExtensionSet) set = NULL;
  g_autoptr(IdeNotification) notif = NULL;
  g_autoptr(IdeTask) task = NULL;
  UpdateDependencies *state;
  IdeContext *context;

  g_assert (IDE_IS_MAIN_THREAD ());
  g_assert (G_IS_SIMPLE_ACTION (action));
  g_assert (IDE_IS_PRIMARY_WORKSPACE (self));

  context = ide_widget_get_context (GTK_WIDGET (self));

  notif = ide_notification_new ();
  ide_notification_set_title (notif, _("Updating Dependencies…"));
  ide_notification_set_body (notif, _("Builder is updating your projects configured dependencies."));
  ide_notification_set_icon_name (notif, "software-update-available-symbolic");
  ide_notification_set_has_progress (notif, TRUE);
  ide_notification_set_progress_is_imprecise (notif, TRUE);
  ide_notification_attach (notif, IDE_OBJECT (context));

  state = g_slice_new0 (UpdateDependencies);
  state->n_active = 0;
  state->notif = g_object_ref (notif);

  task = ide_task_new (self, NULL, NULL, NULL);
  ide_task_set_source_tag (task, ide_primary_workspace_actions_update_dependencies);
  ide_task_set_task_data (task, state, update_dependencies_free);

  set = peas_extension_set_new (peas_engine_get_default (),
                                IDE_TYPE_DEPENDENCY_UPDATER,
                                NULL);
  peas_extension_set_foreach (set,
                              ide_primary_workspace_actions_update_dependencies_cb,
                              task);
  if (state->n_active == 0)
    ide_task_return_boolean (task, TRUE);
}
コード例 #17
0
/**
 * ide_editor_addin_find_by_module_name:
 * @editor: an #IdeEditorPerspective
 * @module_name: the module name of the addin
 *
 * This function allows locating an #IdeEditorAddin that is attached
 * to the #IdeEditorPerspective by the addin module name. The module name
 * should match the value specified in the ".plugin" module definition.
 *
 * Returns: (transfer none) (nullable): An #IdeEditorAddin or %NULL
 */
IdeEditorAddin *
ide_editor_addin_find_by_module_name (IdeEditorPerspective *editor,
                                      const gchar          *module_name)
{
  PeasExtension *ret = NULL;
  PeasPluginInfo *plugin_info;

  g_return_val_if_fail (IDE_IS_EDITOR_PERSPECTIVE (editor), NULL);
  g_return_val_if_fail (module_name != NULL, NULL);

  plugin_info = peas_engine_get_plugin_info (peas_engine_get_default (), module_name);

  if (plugin_info != NULL)
    ret = peas_extension_set_get_extension (editor->addins, plugin_info);
  else
    g_warning ("No such module found \"%s\"", module_name);

  return ret ? IDE_EDITOR_ADDIN (ret) : NULL;
}
コード例 #18
0
static void
ide_recent_projects_init (IdeRecentProjects *self)
{
  PeasExtensionSet *set;
  PeasEngine *engine;

  self->projects = g_sequence_new (g_object_unref);
  self->miners = g_ptr_array_new_with_free_func (g_object_unref);
  self->cancellable = g_cancellable_new ();
  self->recent_uris = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
  self->file_uri = g_build_filename (g_get_user_data_dir (),
                                     ide_get_program_name (),
                                     IDE_RECENT_PROJECTS_BOOKMARK_FILENAME,
                                     NULL);

  engine = peas_engine_get_default ();
  set = peas_extension_set_new (engine, IDE_TYPE_PROJECT_MINER, NULL);
  peas_extension_set_foreach (set, foreach_miner_func, self);
  g_clear_object (&set);
}
コード例 #19
0
static void
ide_preferences_builtin_register_plugins (IdePreferences *preferences)
{
  PeasEngine *engine;
  const GList *list;
  guint i = 0;

  g_assert (IDE_IS_PREFERENCES (preferences));

  engine = peas_engine_get_default ();
  list = peas_engine_get_plugin_list (engine);

  ide_preferences_add_page (preferences, "plugins", _("Extensions"), 700);
  ide_preferences_add_list_group (preferences, "plugins", "installed", _("Installed Extensions"), 0);
  ide_preferences_add_list_group (preferences, "plugins", "builtin", _("Bundled Extensions"), 100);

  for (; list; list = list->next, i++)
    {
      g_autofree gchar *path = NULL;
      PeasPluginInfo *plugin_info = list->data;
      const gchar *desc;
      const gchar *name;
      const gchar *group;

      if (peas_plugin_info_is_hidden (plugin_info))
        continue;

      name = peas_plugin_info_get_name (plugin_info);
      desc = peas_plugin_info_get_description (plugin_info);

      path = g_strdup_printf ("/org/gnome/builder/plugins/%s/",
                              peas_plugin_info_get_module_name (plugin_info));

      if (peas_plugin_info_is_builtin (plugin_info))
        group = "builtin";
      else
        group = "installed";

      ide_preferences_add_switch (preferences, "plugins", group, "org.gnome.builder.plugin", "enabled", path, NULL, name, desc, NULL, i);
    }
}
コード例 #20
0
void
ide_application_init_plugin_accessories (IdeApplication *self)
{
  const GList *list;
  PeasEngine *engine;

  g_assert (IDE_IS_APPLICATION (self));

  self->plugin_gresources = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
                                                   (GDestroyNotify)g_resource_unref);

  engine = peas_engine_get_default ();

  g_signal_connect_object (engine,
                           "load-plugin",
                           G_CALLBACK (ide_application_load_plugin_resources),
                           self,
                           G_CONNECT_AFTER | G_CONNECT_SWAPPED);

  g_signal_connect_object (engine,
                           "unload-plugin",
                           G_CALLBACK (ide_application_unload_plugin_resources),
                           self,
                           G_CONNECT_SWAPPED);

  list = peas_engine_get_plugin_list (engine);

  for (; list != NULL; list = list->next)
    {
      PeasPluginInfo *plugin_info = list->data;
      const gchar *module_name;
      GSettings *settings;

      module_name = peas_plugin_info_get_module_name (plugin_info);
      settings = _ide_application_plugin_get_settings (self, module_name);
      if (!g_settings_get_boolean (settings, "enabled"))
        continue;

      ide_application_load_plugin_resources (self, plugin_info, engine);
    }
}
コード例 #21
0
ファイル: ide-frame.c プロジェクト: GNOME/gnome-builder
/**
 * ide_frame_addin_find_by_module_name:
 * @frame: An #IdeFrame
 * @module_name: the module name which provides the addin
 *
 * This function will locate the #IdeFrameAddin that was registered by
 * the plugin named @module_name (which should match the "Module" field
 * provided in the .plugin file).
 *
 * If no module was found or that module does not implement the
 * #IdeFrameAddinInterface, then %NULL is returned.
 *
 * Returns: (transfer none) (nullable): An #IdeFrameAddin or %NULL
 *
 * Since: 3.32
 */
IdeFrameAddin *
ide_frame_addin_find_by_module_name (IdeFrame    *frame,
                                     const gchar *module_name)
{
  IdeFramePrivate *priv = ide_frame_get_instance_private (frame);
  PeasExtension *ret = NULL;
  PeasPluginInfo *plugin_info;

  g_return_val_if_fail (IDE_IS_FRAME (frame), NULL);
  g_return_val_if_fail (priv->addins != NULL, NULL);
  g_return_val_if_fail (module_name != NULL, NULL);

  plugin_info = peas_engine_get_plugin_info (peas_engine_get_default (), module_name);

  if (plugin_info != NULL)
    ret = peas_extension_set_get_extension (priv->addins, plugin_info);
  else
    g_warning ("No addin could be found matching module \"%s\"", module_name);

  return ret ? IDE_FRAME_ADDIN (ret) : NULL;
}
コード例 #22
0
static void
ide_editor_perspective_hierarchy_changed (GtkWidget *widget,
                                          GtkWidget *old_toplevel)
{
  IdeEditorPerspective *self = (IdeEditorPerspective *)widget;

  g_assert (IDE_IS_EDITOR_PERSPECTIVE (self));
  g_assert (!old_toplevel || GTK_IS_WIDGET (old_toplevel));

  if (self->addins == NULL)
    {
      GtkWidget *toplevel;

      /*
       * If we just got a new toplevel and it is a workbench,
       * and we have not yet created our addins, do so now.
       */

      toplevel = gtk_widget_get_ancestor (widget, IDE_TYPE_WORKBENCH);

      if (toplevel != NULL)
        {
          self->addins = peas_extension_set_new (peas_engine_get_default (),
                                                 IDE_TYPE_EDITOR_ADDIN,
                                                 NULL);
          g_signal_connect (self->addins,
                            "extension-added",
                            G_CALLBACK (ide_editor_perspective_addin_added),
                            self);
          g_signal_connect (self->addins,
                            "extension-removed",
                            G_CALLBACK (ide_editor_perspective_addin_removed),
                            self);
          peas_extension_set_foreach (self->addins,
                                      ide_editor_perspective_addin_added,
                                      self);
        }
    }
}
コード例 #23
0
ファイル: peas-demo.c プロジェクト: KriG46/libpeas
static GtkWidget *
create_main_window (void)
{
    GtkWidget *window;
    GtkWidget *box;
    GtkWidget *manager;
    GtkWidget *button_box;
    GtkWidget *button;

    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    g_signal_connect (window, "delete-event", G_CALLBACK (gtk_main_quit), NULL);
    gtk_container_set_border_width (GTK_CONTAINER (window), 6);
    gtk_window_set_title (GTK_WINDOW (window), "Peas Demo");

    gtk_window_set_has_resize_grip (GTK_WINDOW (window), FALSE);

    box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
    gtk_container_add (GTK_CONTAINER (window), box);

    manager = peas_gtk_plugin_manager_new (peas_engine_get_default ());
    gtk_box_pack_start (GTK_BOX (box), manager, TRUE, TRUE, 0);

    button_box = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
    gtk_box_set_spacing (GTK_BOX (button_box), 6);
    gtk_button_box_set_layout (GTK_BUTTON_BOX (button_box), GTK_BUTTONBOX_END);
    gtk_box_pack_start (GTK_BOX (box), button_box, FALSE, FALSE, 0);

    button = gtk_button_new_with_label ("New window");
    g_signal_connect (button, "clicked", G_CALLBACK (create_new_window), NULL);
    gtk_container_add (GTK_CONTAINER (button_box), button);

    button = gtk_button_new_from_stock (GTK_STOCK_QUIT);
    g_signal_connect (button, "clicked", G_CALLBACK (gtk_main_quit), NULL);
    gtk_container_add (GTK_CONTAINER (button_box), button);

    return window;
}
コード例 #24
0
static void
gb_editor_view_constructed (GObject *object)
{
  GbEditorView *self = (GbEditorView *)object;
  PeasEngine *engine;

  G_OBJECT_CLASS (gb_editor_view_parent_class)->constructed (object);

  engine = peas_engine_get_default ();
  self->extensions = peas_extension_set_new (engine, GB_TYPE_EDITOR_VIEW_ADDIN, NULL);
  g_signal_connect_object (self->extensions,
                           "extension-added",
                           G_CALLBACK (gb_editor_view__extension_added),
                           self,
                           G_CONNECT_SWAPPED);
  g_signal_connect_object (self->extensions,
                           "extension-added",
                           G_CALLBACK (gb_editor_view__extension_removed),
                           self,
                           G_CONNECT_SWAPPED);
  peas_extension_set_foreach (self->extensions,
                              (PeasExtensionSetForeachFunc)gb_editor_view__extension_added,
                              self);
}
コード例 #25
0
static void
ide_keybindings_reload (IdeKeybindings *self)
{
  GdkScreen *screen;
  PeasEngine *engine;
  const GList *list;

  IDE_ENTRY;

  g_assert (IDE_IS_KEYBINDINGS (self));

  {
    g_autofree gchar *path = NULL;
    g_autoptr(GBytes) bytes = NULL;
    g_autoptr(GError) error = NULL;

    if (self->mode == NULL)
      self->mode = g_strdup ("default");

    IDE_TRACE_MSG ("Loading %s keybindings", self->mode);
    path = g_strdup_printf ("/org/gnome/builder/keybindings/%s.css", self->mode);
    bytes = g_resources_lookup_data (path, G_RESOURCE_LOOKUP_FLAGS_NONE, &error);

    if (error == NULL)
      {
        /*
         * We use -1 for the length so that the CSS provider knows that the
         * string is \0 terminated. This is guaranteed to us by GResources so
         * that interned data can be used as C strings.
         */
        gtk_css_provider_load_from_data (self->css_provider,
                                         g_bytes_get_data (bytes, NULL),
                                         -1,
                                         &error);
      }

    if (error)
      g_warning ("%s", error->message);
  }

  engine = peas_engine_get_default ();
  screen = gdk_screen_get_default ();

  if (self->plugin_providers != NULL)
    {
      GHashTableIter iter;
      GtkStyleProvider *provider;

      g_hash_table_iter_init (&iter, self->plugin_providers);
      while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&provider))
        gtk_style_context_remove_provider_for_screen (screen, provider);

      g_clear_pointer (&self->plugin_providers, g_hash_table_unref);
    }

  self->plugin_providers = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);

  list = peas_engine_get_plugin_list (engine);

  for (; list != NULL; list = list->next)
    {
      PeasPluginInfo *plugin_info = list->data;

      if (!peas_plugin_info_is_loaded (plugin_info))
        continue;

      ide_keybindings_load_plugin (self, plugin_info, engine);
    }

  IDE_EXIT;
}
コード例 #26
0
ファイル: pragha.c プロジェクト: TingPing/pragha
static void
pragha_application_startup (GApplication *application)
{
	PraghaApplication *pragha = PRAGHA_APPLICATION (application);

	PraghaToolbar *toolbar;
	PraghaPlaylist *playlist;

	const GBindingFlags binding_flags =
		G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL;

	G_APPLICATION_CLASS (pragha_application_parent_class)->startup (application);

	/* Allocate memory for simple structures */

	pragha->preferences = pragha_preferences_get();

	pragha->cdbase = pragha_database_get();
	if (pragha_database_start_successfully(pragha->cdbase) == FALSE) {
		g_error("Unable to init music dbase");
	}

	pragha->enum_map = pragha_music_enum_get ();
	g_signal_connect (pragha->enum_map, "enum-removed",
	                  G_CALLBACK(pragha_enum_map_removed_handler), pragha);

#ifdef HAVE_LIBPEAS
	pragha->peas_engine = peas_engine_get_default ();

	peas_engine_add_search_path (pragha->peas_engine, LIBPLUGINDIR, USRPLUGINDIR);
	pragha->peas_exten_set = peas_extension_set_new (pragha->peas_engine,
	                                                 PEAS_TYPE_ACTIVATABLE,
	                                                 "object", pragha,
	                                                 NULL);

	peas_extension_set_foreach (pragha->peas_exten_set,
	                            (PeasExtensionSetForeachFunc) on_extension_added,
	                            NULL);

	g_signal_connect (pragha->peas_exten_set, "extension-added",
	                  G_CALLBACK (on_extension_added), NULL);
	g_signal_connect (pragha->peas_exten_set, "extension-removed",
	                  G_CALLBACK (on_extension_removed), NULL);
#endif

	pragha->art_cache = pragha_art_cache_get ();
	g_signal_connect (pragha->art_cache, "cache-changed",
	                  G_CALLBACK(pragha_art_cache_changed_handler), pragha);

	pragha->backend = pragha_backend_new ();

	g_signal_connect (pragha->backend, "finished",
	                  G_CALLBACK(pragha_backend_finished_song), pragha);
	g_signal_connect (pragha->backend, "tags-changed",
	                  G_CALLBACK(pragha_backend_tags_changed), pragha);

	g_signal_connect (pragha->backend, "error",
	                 G_CALLBACK(gui_backend_error_show_dialog_cb), pragha);
	g_signal_connect (pragha->backend, "error",
	                  G_CALLBACK(gui_backend_error_update_current_playlist_cb), pragha);
	g_signal_connect (pragha->backend, "notify::state",
	                  G_CALLBACK (pragha_menubar_update_playback_state_cb), pragha);

	/*
	 * Collect widgets and construct the window.
	 */

	pragha_application_construct_window (pragha);

	/* Connect Signals and Bindings. */

	toolbar = pragha->toolbar;
	g_signal_connect_swapped (toolbar, "prev",
	                          G_CALLBACK(pragha_playback_prev_track), pragha);
	g_signal_connect_swapped (toolbar, "play",
	                          G_CALLBACK(pragha_playback_play_pause_resume), pragha);
	g_signal_connect_swapped (toolbar, "stop",
	                          G_CALLBACK(pragha_playback_stop), pragha);
	g_signal_connect_swapped (toolbar, "next",
	                          G_CALLBACK(pragha_playback_next_track), pragha);
	g_signal_connect (toolbar, "unfull-activated",
	                  G_CALLBACK(pragha_window_unfullscreen), pragha);
	g_signal_connect (toolbar, "album-art-activated",
	                  G_CALLBACK(pragha_playback_show_current_album_art), pragha);
	g_signal_connect (toolbar, "track-info-activated",
	                  G_CALLBACK(pragha_playback_edit_current_track), pragha);
	g_signal_connect (toolbar, "track-progress-activated",
	                  G_CALLBACK(pragha_playback_seek_fraction), pragha);

	playlist = pragha->playlist;
	g_signal_connect (playlist, "playlist-set-track",
	                  G_CALLBACK(pragha_playback_set_playlist_track), pragha);
	g_signal_connect (playlist, "playlist-change-tags",
	                  G_CALLBACK(pragha_playlist_update_change_tags), pragha);
	g_signal_connect (playlist, "playlist-changed",
	                  G_CALLBACK(pragha_playlist_update_statusbar_playtime), pragha);
	pragha_playlist_update_statusbar_playtime (playlist, pragha);
		
	g_signal_connect (pragha->library, "library-append-playlist",
	                  G_CALLBACK(pragha_library_pane_append_tracks), pragha);
	g_signal_connect (pragha->library, "library-replace-playlist",
	                  G_CALLBACK(pragha_library_pane_replace_tracks), pragha);
	g_signal_connect (pragha->library, "library-replace-playlist-and-play",
	                  G_CALLBACK(pragha_library_pane_replace_tracks_and_play), pragha);

	g_signal_connect (G_OBJECT(pragha->mainwindow), "window-state-event",
	                  G_CALLBACK(pragha_toolbar_window_state_event), toolbar);
	g_signal_connect (G_OBJECT(toolbar), "notify::timer-remaining-mode",
	                  G_CALLBACK(pragha_toolbar_show_ramaning_time_cb), pragha->backend);

	g_signal_connect (pragha->backend, "notify::state",
	                  G_CALLBACK(pragha_toolbar_playback_state_cb), toolbar);
	g_signal_connect (pragha->backend, "tick",
	                 G_CALLBACK(pragha_toolbar_update_playback_progress), toolbar);
	g_signal_connect (pragha->backend, "buffering",
	                  G_CALLBACK(pragha_toolbar_update_buffering_cb), toolbar);

	g_signal_connect (pragha->backend, "notify::state",
	                  G_CALLBACK (update_current_playlist_view_playback_state_cb), pragha->playlist);

	g_object_bind_property (pragha->backend, "volume",
	                        toolbar, "volume",
	                        binding_flags);

	g_object_bind_property (pragha->preferences, "timer-remaining-mode",
	                        toolbar, "timer-remaining-mode",
	                        binding_flags);

	pragha->sidebar2_binding =
		g_object_bind_property (pragha->preferences, "secondary-lateral-panel",
		                        pragha->sidebar2, "visible",
		                        binding_flags);
	
	pragha->setting_dialog = pragha_preferences_dialog_new (pragha);

	#ifdef HAVE_LIBPEAS
	pragha_plugins_activate_saved (pragha);
	#endif

	/* Finally fill the library and the playlist */

	pragha_init_gui_state (pragha);
}
コード例 #27
0
void
ide_application_discover_plugins (IdeApplication *self)
{
  PeasEngine *engine = peas_engine_get_default ();
  const GList *list;
  gchar *path;
  g_autoptr(GError) error = NULL;

  g_return_if_fail (IDE_IS_APPLICATION (self));

  if (g_getenv ("GB_IN_TREE_PLUGINS") != NULL)
    {
      GDir *dir;

      g_irepository_prepend_search_path (BUILDDIR"/src/gstyle");
      g_irepository_prepend_search_path (BUILDDIR"/src/libide");

      if ((dir = g_dir_open (BUILDDIR"/src/plugins", 0, NULL)))
        {
          const gchar *name;

          while ((name = g_dir_read_name (dir)))
            {
              path = g_build_filename (BUILDDIR, "src", "plugins", name, NULL);
              peas_engine_prepend_search_path (engine, path, path);
              g_free (path);
            }

          g_dir_close (dir);
        }
    }
  else
    {
      g_irepository_prepend_search_path (PACKAGE_LIBDIR"/gnome-builder/girepository-1.0");

      peas_engine_prepend_search_path (engine,
                                       PACKAGE_LIBDIR"/gnome-builder/plugins",
                                       PACKAGE_DATADIR"/gnome-builder/plugins");
    }

  /*
   * We have access to ~/.local/share/gnome-builder/ for plugins even when we are
   * bundled with flatpak, so might as well use it.
   */
  if (ide_is_flatpak ())
    {
      g_autofree gchar *plugins_dir = g_build_filename (g_get_home_dir (),
                                                        ".local",
                                                        "share",
                                                        "gnome-builder",
                                                        "plugins",
                                                        NULL);
      g_irepository_prepend_search_path (plugins_dir);
      peas_engine_prepend_search_path (engine, plugins_dir, plugins_dir);
    }

  if (!g_irepository_require (NULL, "Ide", "1.0", 0, &error) ||
      !g_irepository_require (NULL, "Gtk", "3.0", 0, &error) ||
      !g_irepository_require (NULL, "Dazzle", "1.0", 0, &error))
    g_warning ("Cannot enable Python 3 plugins: %s", error->message);
  else
    {
      /* Avoid spamming stderr with Ide import tracebacks */
      peas_engine_enable_loader (engine, "python3");
    }

  peas_engine_prepend_search_path (engine, "resource:///org/gnome/builder/plugins/", NULL);

  path = g_build_filename (g_get_user_data_dir (), "gnome-builder", "plugins", NULL);
  peas_engine_prepend_search_path (engine, path, NULL);
  g_free (path);

  list = peas_engine_get_plugin_list (engine);

  for (; list; list = list->next)
    {
      PeasPluginInfo *plugin_info = list->data;

      g_debug ("Discovered plugin \"%s\"",
               peas_plugin_info_get_module_name (plugin_info));
    }
}
コード例 #28
0
ファイル: window.c プロジェクト: deejay1/emerillon
static void
emerillon_window_init (EmerillonWindow *self)
{
  GdkGeometry geometry;
  GeoclueMaster *master = NULL;
  GError *error = NULL;

  gint width, height;

  self->priv = EMERILLON_WINDOW_GET_PRIVATE (self);


  self->priv->position_auto_update = FALSE;

  /* GSettings. */
  self->priv->settings_ui = g_settings_new (EMERILLON_SCHEMA_UI);

  /* Extension setup */
  self->priv->ext_set = peas_extension_set_new (peas_engine_get_default (),
                                                PEAS_TYPE_ACTIVATABLE,
                                                NULL);

  peas_extension_set_call (self->priv->ext_set, "activate");

  g_signal_connect (self->priv->ext_set, "extension-added", G_CALLBACK (on_extension_added), self);
  g_signal_connect (self->priv->ext_set, "extension-removed", G_CALLBACK (on_extension_removed), self);
  
  /* Window setup. */
  geometry.min_width = 400;
  geometry.min_height = 350;
  gtk_window_set_geometry_hints (GTK_WINDOW (self), GTK_WIDGET (self),
      &geometry,GDK_HINT_MIN_SIZE);

  /* Set the window size */
  width = g_settings_get_int (self->priv->settings_ui,
      EMERILLON_CONF_UI_WINDOW_WIDTH);
  height = g_settings_get_int (self->priv->settings_ui,
      EMERILLON_CONF_UI_WINDOW_HEIGHT);

  if (width > 0 && height > 0)
    gtk_window_set_default_size (GTK_WINDOW (self), width, height);
  else
    gtk_window_set_default_size (GTK_WINDOW (self), 640, 450);

  /* Current position. */
  master = geoclue_master_get_default ();
  self->priv->geoclue_client = geoclue_master_create_client (master, NULL, &error);
  if (!self->priv->geoclue_client)
    {
       g_warning ("Creating Geoclue Master client failed: %s", error->message);
       g_error_free (error);
       g_object_unref (master);
       return;
    }
  g_object_unref (master);

  geoclue_master_client_set_requirements (self->priv->geoclue_client,
                                          GEOCLUE_ACCURACY_LEVEL_COUNTRY, 0, FALSE, GEOCLUE_RESOURCE_ALL, NULL);
  self->priv->geoclue_position = geoclue_master_client_create_position (self->priv->geoclue_client, &error);
  if (self->priv->geoclue_position)
  {
    g_object_set_data (G_OBJECT (self->priv->geoclue_position), "client", self->priv->geoclue_client);
    g_signal_connect(self->priv->geoclue_position, "position-changed",
                     G_CALLBACK(position_changed_cb), NULL);
  }
  else
  {
    g_warning ("Getting Geoclue Position Failed: %s", error->message);
    g_error_free (error);
    if (self->priv->geoclue_client)
      g_object_unref (self->priv->geoclue_client);
  }

}
コード例 #29
0
void
ide_workbench_set_context (IdeWorkbench *self,
                           IdeContext   *context)
{
  g_autoptr(GSettings) settings = NULL;
  IdeBuildManager *build_manager;
  IdeRunManager *run_manager;
  IdeProject *project;
  guint delay_msec;

  IDE_ENTRY;

  g_return_if_fail (IDE_IS_WORKBENCH (self));
  g_return_if_fail (IDE_IS_CONTEXT (context));
  g_return_if_fail (self->context == NULL);

  settings = g_settings_new ("org.gnome.builder");

  g_set_object (&self->context, context);

  project = ide_context_get_project (context);
  g_object_bind_property_full (project, "name",
                               self, "title",
                               G_BINDING_SYNC_CREATE,
                               transform_title, NULL, NULL, NULL);

  build_manager = ide_context_get_build_manager (context);
  gtk_widget_insert_action_group (GTK_WIDGET (self),
                                  "build-manager",
                                  G_ACTION_GROUP (build_manager));

  run_manager = ide_context_get_run_manager (context);
  gtk_widget_insert_action_group (GTK_WIDGET (self),
                                  "run-manager",
                                  G_ACTION_GROUP (run_manager));

  self->addins = peas_extension_set_new (peas_engine_get_default (),
                                         IDE_TYPE_WORKBENCH_ADDIN,
                                         NULL);

  g_signal_connect (self->addins,
                    "extension-added",
                    G_CALLBACK (ide_workbench_addin_added),
                    self);

  g_signal_connect (self->addins,
                    "extension-removed",
                    G_CALLBACK (ide_workbench_addin_removed),
                    self);

  peas_extension_set_foreach (self->addins, ide_workbench_addin_added, self);

  g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_CONTEXT]);

  /*
   * Creating all the addins above is a bit intensive, so give ourselves
   * just a bit of time to stablize allocations and sizing before
   * transitioning to the editor.
   */
  delay_msec = self->disable_greeter ? 0 : STABLIZE_DELAY_MSEC;
  g_timeout_add (delay_msec, stablize_cb, g_object_ref (self));

  /*
   * When restoring, previous buffers may get loaded. This causes new
   * widgets to be created and added to the workspace. Doing so during
   * the stack transition results in non-smooth transitions. So instead,
   * we will delay until the transition has completed.
   */
  if (g_settings_get_boolean (settings, "restore-previous-files"))
    {
      guint duration = 0;

      if (!self->disable_greeter)
        duration = gtk_stack_get_transition_duration (self->perspectives_stack);
      g_timeout_add (delay_msec + duration, restore_in_timeout, g_object_ref (context));
    }

  IDE_EXIT;
}
コード例 #30
0
int main(int argc, char **argv)
{
	IsApplication *application;
        GSettings *settings;
        IsManager *manager;
	gchar *plugin_dir;
	PeasEngine *engine;
	PeasExtensionSet *set;
	GError *error = NULL;

	gtk_init(&argc, &argv);

	if (!g_irepository_require(g_irepository_get_default(), "Peas", "1.0",
				   0, &error))
	{
		is_warning("main", "Could not load Peas repository: %s", error->message);
		g_error_free (error);
		error = NULL;
	}

	engine = peas_engine_get_default();
	g_signal_connect(engine, "notify::plugin-list",
			 G_CALLBACK(on_plugin_list_notify), NULL);

	/* add home dir to search path */
	plugin_dir = g_build_filename(g_get_user_config_dir(), PACKAGE,
				      "plugins", NULL);
	peas_engine_add_search_path(engine, plugin_dir, NULL);
	g_free(plugin_dir);

	/* add system path to search path */
	plugin_dir = g_build_filename(LIBDIR, PACKAGE, "plugins", NULL);
	peas_engine_add_search_path(engine, plugin_dir, NULL);
	g_free(plugin_dir);

        /* init notifications */
        is_notify_init();
	application = is_application_new();
        settings = g_settings_new("indicator-sensors.application");
        g_settings_bind(settings, "temperature-scale",
                        application, "temperature-scale",
                        G_SETTINGS_BIND_DEFAULT);

	/* create extension set and set manager as object */
	set = peas_extension_set_new(engine, PEAS_TYPE_ACTIVATABLE,
				     "object", application, NULL);

	/* activate all activatable extensions */
	peas_extension_set_call(set, "activate");

	/* and make sure to activate any ones which are found in the future */
	g_signal_connect(set, "extension-added",
			 G_CALLBACK(on_extension_added), application);
	g_signal_connect(set, "extension-removed",
			  G_CALLBACK(on_extension_removed), application);

        /* since all plugins are now inited show a notification if we detected
         * sensors but none are enabled - TODO: perhaps just open the pref's
         * dialog?? */
        manager = is_application_get_manager(application);
        GSList *sensors = is_manager_get_all_sensors_list(manager);
        if (sensors) {
                gchar **enabled_sensors = is_manager_get_enabled_sensors(manager);
                if (!g_strv_length(enabled_sensors)) {
                        is_notify(IS_NOTIFY_LEVEL_INFO,
                                  _("No Sensors Enabled For Monitoring"),
                                  _("Sensors detected but none are enabled for monitoring. To enable monitoring of sensors open the Preferences window and select the sensors to monitor"));
                }
                g_strfreev(enabled_sensors);
                g_slist_foreach(sensors, (GFunc)g_object_unref, NULL);
                g_slist_free(sensors);
        }

	gtk_main();

        g_object_unref(application);
        is_notify_uninit();

	return 0;
}