1. 22 Dec, 2011 1 commit
  2. 20 Dec, 2011 1 commit
  3. 06 Dec, 2011 4 commits
  4. 17 Nov, 2011 1 commit
  5. 18 Oct, 2011 2 commits
  6. 20 Sep, 2011 1 commit
    • David Zeuthen's avatar
      Add support for the org.freedesktop.policykit.imply annotation · 6bbd5189
      David Zeuthen authored
      For example, GNOME control center can now defined e.g.
      
        <action id="org.zee.example.meta">
          <description>Meta Action</description>
          <message>Example of a meta action, blabla</message>
          <defaults>
            <allow_any>no</allow_any>
            <allow_inactive>no</allow_inactive>
            <allow_active>auth_admin_keep</allow_active>
          </defaults>
          <annotate key="org.freedesktop.policykit.imply">org.freedesktop.udisks2.ata-smart-selftest org.freedesktop.udisks2.encrypted-lock-others org.freedesktop.udisks2.filesystem-unmount-others</annotate>
        </action>
      
      and set up a single GtkLockButton for a PolkitPermission for action id
      "org.zee.example.meta".
      
      When unlocked the given subject will now be authorized for the actions
      mentioned in the annotation.
      
      Example test program:
      
      int
      main (int argc, char *argv[])
      {
        PolkitSubject *subject;
        GtkWidget *window;
        GtkWidget *table;
        GMainLoop *loop;
        guint n;
      
        gtk_init (&argc, &argv);
      
        subject = polkit_unix_process_new (getpid ());
      
        window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
      
        table = gtk_table_new (1, 2, FALSE);
        for (n = 1; n < argc; n++)
          {
            const gchar *action_id = argv[n];
            GPermission *permission;
            GtkWidget *label;
            GtkWidget *lock_button;
            GError *error = NULL;
      
            label = gtk_label_new (action_id);
      
            permission = polkit_permission_new_sync (action_id, subject, NULL, &error);
            if (permission == NULL)
              {
                g_error ("Error constructing permission for action_id %s: %s (%s, %d)",
                         action_id, error->message, g_quark_to_string (error->domain), error->code);
                goto out;
              }
            lock_button = gtk_lock_button_new (permission);
            g_object_unref (permission);
      
            gtk_table_attach (GTK_TABLE (table), label,       0, 1, n - 1, n, GTK_FILL, GTK_FILL, 0, 0);
            gtk_table_attach (GTK_TABLE (table), lock_button, 1, 2, n - 1, n, GTK_FILL, GTK_FILL, 0, 0);
          }
        gtk_container_add (GTK_CONTAINER (window), table);
      
        gtk_widget_show_all (window);
      
        loop = g_main_loop_new (NULL, FALSE);
        g_main_loop_run (loop);
      
       out:
        ;
      }
      
      Compile with:
      
       gcc -o showpolkit showpolkit.c `pkg-config --cflags --libs polkit-gobject-1 gtk+-3.0` -g -O0
      
      Run with:
      
       ./showpolkit org.freedesktop.udisks2.ata-smart-selftest org.freedesktop.udisks2.encrypted-lock-others org.freedesktop.udisks2.filesystem-unmount-others org.zee.example.meta
      Signed-off-by: 's avatarDavid Zeuthen <davidz@redhat.com>
      6bbd5189
  7. 01 Aug, 2011 5 commits
  8. 29 Jun, 2011 1 commit
  9. 20 Apr, 2011 1 commit
  10. 01 Apr, 2011 3 commits
  11. 31 Mar, 2011 1 commit
  12. 14 Mar, 2011 1 commit
  13. 11 Mar, 2011 1 commit
  14. 03 Mar, 2011 5 commits
  15. 23 Feb, 2011 12 commits