Ejemplo n.º 1
0
GNotificationBackend *
g_notification_backend_new_default (GApplication *application)
{
  GType backend_type;
  GNotificationBackend *backend;

  g_return_val_if_fail (G_IS_APPLICATION (application), NULL);

  backend_type = _g_io_module_get_default_type (G_NOTIFICATION_BACKEND_EXTENSION_POINT_NAME,
                                                "GNOTIFICATION_BACKEND",
                                                G_STRUCT_OFFSET (GNotificationBackendClass, is_supported));

  backend = g_object_new (backend_type, NULL);

  /* Avoid ref cycle by not taking a ref to the application at all. The
   * backend only lives as long as the application does.
   */
  backend->application = application;

  backend->dbus_connection = g_application_get_dbus_connection (application);
  if (backend->dbus_connection)
    g_object_ref (backend->dbus_connection);

  return backend;
}
Ejemplo n.º 2
0
/**
 * g_application_set_action_group:
 * @application: a #GApplication
 * @action_group: (allow-none): a #GActionGroup, or %NULL
 *
 * Sets or unsets the group of actions associated with the application.
 *
 * These actions are the actions that can be remotely invoked.
 *
 * It is an error to call this function after the application has been
 * registered.
 *
 * Since: 2.28
 **/
void
g_application_set_action_group (GApplication *application,
                                GActionGroup *action_group)
{
  g_return_if_fail (G_IS_APPLICATION (application));
  g_return_if_fail (!application->priv->is_registered);

  if (application->priv->actions != NULL)
    g_object_unref (application->priv->actions);

  application->priv->actions = action_group;

  if (application->priv->actions != NULL)
    g_object_ref (application->priv->actions);
}
Ejemplo n.º 3
0
/**
 * g_paste_applet_footer_new:
 * @client: a #GPasteClient instance
 * @app: (nullable): the #GApplication to quit
 *
 * Create a new instance of #GPasteAppletFooter
 *
 * Returns: a newly allocated #GPasteAppletFooter
 *          free it with g_object_unref
 */
G_PASTE_VISIBLE GPasteAppletFooter *
g_paste_applet_footer_new (GPasteClient *client,
                           GApplication *app)
{
    g_return_val_if_fail (G_PASTE_IS_CLIENT (client), NULL);
    g_return_val_if_fail ((!app || G_IS_APPLICATION (app)), NULL);

    GPasteAppletFooter *self = g_object_new (G_PASTE_TYPE_APPLET_FOOTER, NULL);
    GPasteAppletFooterPrivate *priv = g_paste_applet_footer_get_instance_private (self);

    priv->empty = g_paste_applet_empty_new (client);
    priv->about = g_paste_applet_about_new (client);
    if (app)
        priv->quit = g_paste_applet_quit_new (app);

    return self;
}
static void
gbp_greeter_application_addin_add_option_entries (IdeApplicationAddin *addin,
                                                  IdeApplication      *app)
{
  g_assert (IDE_IS_APPLICATION_ADDIN (addin));
  g_assert (G_IS_APPLICATION (app));

  g_application_add_main_option (G_APPLICATION (app),
                                 "greeter",
                                 'g',
                                 G_OPTION_FLAG_IN_MAIN,
                                 G_OPTION_ARG_NONE,
                                 _("Display a new greeter window"),
                                 NULL);

  g_application_add_main_option (G_APPLICATION (app),
                                 "clone",
                                 0,
                                 G_OPTION_FLAG_IN_MAIN,
                                 G_OPTION_ARG_STRING,
                                 _("Begin cloning project from URI"),
                                 "URI");
}