[gtkmm] Add Gtk::LockButton
- From: Juan R. Garcia Blanco <juanrgar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] Add Gtk::LockButton
- Date: Mon, 21 Jul 2014 17:18:39 +0000 (UTC)
commit 093f1b358d54ae325b20999f285a71cd2561e59f
Author: Juan R. GarcĂa Blanco <juanrgar gmail com>
Date: Mon Jul 21 19:09:49 2014 +0200
Add Gtk::LockButton
* .gitignore: Ignore gtk/gtkmm/lockbutton.[cc|h]
* docs/reference/images/widgets/lockbutton*: New files
containing lock button widget states.
* gtk/src/filelist.am: Add gtk/src/lockbutton.hg
* gtk/src/lockbutton.[ccg|hg]: New files.
* tools/m4/convert_gtk.m4: Needed conversions for
Gio::Permission.
.gitignore | 2 +
docs/reference/images/widgets/lockbutton1.png | Bin 0 -> 1634 bytes
docs/reference/images/widgets/lockbutton2.png | Bin 0 -> 1394 bytes
docs/reference/images/widgets/lockbutton3.png | Bin 0 -> 1262 bytes
gtk/src/filelist.am | 1 +
gtk/src/lockbutton.ccg | 31 ++++++++
gtk/src/lockbutton.hg | 94 +++++++++++++++++++++++++
tools/m4/convert_gtk.m4 | 5 ++
8 files changed, 133 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 1fa59ce..31c2a20 100644
--- a/.gitignore
+++ b/.gitignore
@@ -328,6 +328,8 @@ gtk/gtkmm/listboxrow.cc
gtk/gtkmm/listboxrow.h
gtk/gtkmm/liststore.cc
gtk/gtkmm/liststore.h
+gtk/gtkmm/lockbutton.cc
+gtk/gtkmm/lockbutton.h
gtk/gtkmm/main.cc
gtk/gtkmm/main.h
gtk/gtkmm/menu.cc
diff --git a/docs/reference/images/widgets/lockbutton1.png b/docs/reference/images/widgets/lockbutton1.png
new file mode 100644
index 0000000..dec1e7c
Binary files /dev/null and b/docs/reference/images/widgets/lockbutton1.png differ
diff --git a/docs/reference/images/widgets/lockbutton2.png b/docs/reference/images/widgets/lockbutton2.png
new file mode 100644
index 0000000..a1d5f71
Binary files /dev/null and b/docs/reference/images/widgets/lockbutton2.png differ
diff --git a/docs/reference/images/widgets/lockbutton3.png b/docs/reference/images/widgets/lockbutton3.png
new file mode 100644
index 0000000..ef9374a
Binary files /dev/null and b/docs/reference/images/widgets/lockbutton3.png differ
diff --git a/gtk/src/filelist.am b/gtk/src/filelist.am
index 8ab5526..ad15dc0 100644
--- a/gtk/src/filelist.am
+++ b/gtk/src/filelist.am
@@ -110,6 +110,7 @@ gtkmm_files_any_hg = \
listbox.hg \
listboxrow.hg \
liststore.hg \
+ lockbutton.hg \
main.hg \
menu.hg \
menubar.hg \
diff --git a/gtk/src/lockbutton.ccg b/gtk/src/lockbutton.ccg
new file mode 100644
index 0000000..2707e43
--- /dev/null
+++ b/gtk/src/lockbutton.ccg
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2014 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <gtk/gtk.h>
+
+
+namespace Gtk
+{
+
+void LockButton::unset_permission()
+{
+ gtk_lock_button_set_permission(gobj(), NULL);
+}
+
+} // namespace Gtk
+
diff --git a/gtk/src/lockbutton.hg b/gtk/src/lockbutton.hg
new file mode 100644
index 0000000..b9d8ac4
--- /dev/null
+++ b/gtk/src/lockbutton.hg
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2014 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <giomm/permission.h>
+#include <gtkmm/button.h>
+_DEFS(gtkmm,gtk)
+_PINCLUDE(gtkmm/private/button_p.h)
+
+namespace Gtk
+{
+
+/** A widget to unlock or lock privileged operations.
+ *
+ * LockButton is a widget that can be used in control panels or
+ * preference dialogs to allow users to obtain and revoke authorizations
+ * needed to operate the controls. The required authorization is represented
+ * by a Gio::Permission object. Concrete implementations of Gio::Permission may use
+ * PolicyKit or some other authorization framework. To obtain a PolicyKit-based
+ * Gio::Permission, use polkit_permission_new().
+ *
+ * If the user is not currently allowed to perform the action, but can obtain
+ * the permission, the widget looks like this:
+ *
+ * @image html lockbutton1.png
+ *
+ * and the user can click the button to request the permission. Depending
+ * on the platform, this may pop up an authentication dialog or ask the user
+ * to authenticate in some other way. Once the user has obtained the permission,
+ * the widget changes to this:
+ *
+ * @image html lockbutton2.png
+ *
+ * and the permission can be dropped again by clicking the button. If the user
+ * is not able to obtain the permission at all, the widget looks like this:
+ *
+ * @image html lockbutton3.png
+ *
+ * If the user has the permission and cannot drop it, the button is hidden.
+ *
+ * The text (and tooltips) that are shown in the various cases can be adjusted
+ * with the LockButton::property_text_lock(), LockButton::property_text_unlock(),
+ * LockButton::property_tooltip_lock(), LockButton::property_tooltip_unlock() and
+ * LockButton::property_tooltip_not_authorized() properties.
+ *
+ * @ingroup Widgets
+ * @newin{3,14}
+ */
+class LockButton : public Button
+{
+ _CLASS_GTKOBJECT(LockButton, GtkLockButton, GTK_LOCK_BUTTON, Gtk::Button, GtkButton)
+public:
+
+ /** Create a new lock button.
+ */
+ _CTOR_DEFAULT
+
+ _WRAP_CTOR(LockButton(const Glib::RefPtr<const Gio::Permission>& permission), gtk_lock_button_new)
+
+
+ _WRAP_METHOD(Glib::RefPtr<Gio::Permission> get_permission(), gtk_lock_button_get_permission, refreturn)
+ _WRAP_METHOD(Glib::RefPtr<const Gio::Permission> get_permission() const, gtk_lock_button_get_permission,
refreturn, constversion)
+ _WRAP_METHOD(void set_permission(const Glib::RefPtr<const Gio::Permission>& permission),
gtk_lock_button_set_permission)
+ /** Unset permission.
+ * See set_permission().
+ */
+ void unset_permission();
+
+
+ _WRAP_PROPERTY("permission", Glib::RefPtr<Gio::Permission>)
+ _WRAP_PROPERTY("text-lock", Glib::ustring)
+ _WRAP_PROPERTY("text-unlock", Glib::ustring)
+ _WRAP_PROPERTY("tooltip-lock", Glib::ustring)
+ _WRAP_PROPERTY("tooltip-unlock", Glib::ustring)
+ _WRAP_PROPERTY("tooltip-not-authorized", Glib::ustring)
+
+ // Gtk::LockButton has no signals as of 3.2.
+};
+
+} // namespace Gtk
diff --git a/tools/m4/convert_gtk.m4 b/tools/m4/convert_gtk.m4
index 17880e0..202a5a3 100644
--- a/tools/m4/convert_gtk.m4
+++ b/tools/m4/convert_gtk.m4
@@ -718,3 +718,8 @@ _CONVERSION(`GtkDragResult',`DragResult',`($2)$3')
_CONVERSION(`GtkWidgetPath*',`WidgetPath',`Glib::wrap($3, true)')
_CONVERSION(`const GtkWidgetPath*',`WidgetPath',`Glib::wrap(const_cast<GtkWidgetPath*>($3), true)')
+
+# Used by LockButton
+_CONVERSION(`Glib::RefPtr<Gio::Permission>&',`GPermission*',__CONVERT_REFPTR_TO_P)
+_CONVERSION(`const Glib::RefPtr<const
Gio::Permission>&',`GPermission*',__CONVERT_CONST_REFPTR_TO_P_SUN(Gio::Permission))
+_CONVERSION(`GPermission*',`Glib::RefPtr<Gio::Permission>',`Glib::wrap($3)')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]