aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-06-21 14:13:00 -0500
committerTed Gould <ted@gould.cx>2011-06-21 14:13:00 -0500
commit7cb01301fdb2e2889d8ab8c09275c25d9dd28f01 (patch)
treeb0ed1a19c9aebc5506b58d280980ed80a519fd7a /src
parentc187878ad6dd3a5f1406de00880580479601476c (diff)
parent3c5f6a06ff0e44945f788254c44ede18f4061724 (diff)
downloadayatana-indicator-datetime-7cb01301fdb2e2889d8ab8c09275c25d9dd28f01.tar.gz
ayatana-indicator-datetime-7cb01301fdb2e2889d8ab8c09275c25d9dd28f01.tar.bz2
ayatana-indicator-datetime-7cb01301fdb2e2889d8ab8c09275c25d9dd28f01.zip
Import upstream version 0.2.90
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.in4
-rw-r--r--src/datetime-prefs.c83
-rw-r--r--src/indicator-datetime.c11
-rw-r--r--src/timezone-completion.c6
4 files changed, 63 insertions, 41 deletions
diff --git a/src/Makefile.in b/src/Makefile.in
index e152d86..2d9231f 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -166,6 +166,7 @@ DATADIRNAME = @DATADIRNAME@
DBUSSERVICEDIR = @DBUSSERVICEDIR@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
@@ -211,6 +212,7 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
@@ -253,6 +255,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
@@ -286,7 +289,6 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
diff --git a/src/datetime-prefs.c b/src/datetime-prefs.c
index 9b00e60..85068c7 100644
--- a/src/datetime-prefs.c
+++ b/src/datetime-prefs.c
@@ -33,7 +33,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include <unique/unique.h>
-#include <polkitgtk/polkitgtk.h>
+#include <polkit/polkit.h>
#include "dbus-shared.h"
#include "settings-shared.h"
@@ -115,23 +115,49 @@ add_widget_dependency (GtkWidget * parent, GtkWidget * dependent)
}
static void
-polkit_dependency_cb (GtkWidget * parent, GParamSpec *pspec, GtkWidget * dependent)
+polkit_dependency_cb (GPermission * permission, GParamSpec *pspec, GtkWidget * dependent)
{
- gboolean authorized, sensitive;
- g_object_get (G_OBJECT (parent),
- "is-authorized", &authorized,
- "sensitive", &sensitive, NULL);
- gtk_widget_set_sensitive (dependent, authorized && sensitive);
+ gboolean allowed = FALSE;
+
+ g_object_get (G_OBJECT (permission),
+ "allowed", &allowed, NULL);
+
+ gtk_widget_set_sensitive (dependent, allowed);
+}
+
+static void
+add_polkit_dependency_helper (GtkWidget * parent, GParamSpec *pspec, GtkWidget * dependent)
+{
+ GtkLockButton * button = GTK_LOCK_BUTTON (parent);
+ GPermission * permission = gtk_lock_button_get_permission (button);
+ g_signal_connect (permission, "notify::allowed",
+ G_CALLBACK(polkit_dependency_cb), dependent);
+ polkit_dependency_cb (permission, NULL, dependent);
}
static void
add_polkit_dependency (GtkWidget * parent, GtkWidget * dependent)
{
- g_signal_connect (parent, "notify::is-authorized", G_CALLBACK(polkit_dependency_cb),
+ /* polkit async hasn't finished at this point, so wait for permission to come in */
+ g_signal_connect (parent, "notify::permission", G_CALLBACK(add_polkit_dependency_helper),
dependent);
- g_signal_connect (parent, "notify::sensitive", G_CALLBACK(polkit_dependency_cb),
- dependent);
- polkit_dependency_cb (parent, NULL, dependent);
+ gtk_widget_set_sensitive (dependent, FALSE);
+}
+
+static void
+polkit_perm_ready (GObject *source_object, GAsyncResult *res, gpointer user_data)
+{
+ GError * error = NULL;
+ GPermission * permission = polkit_permission_new_finish (res, &error);
+
+ if (error != NULL) {
+ g_warning ("Could not get permission object: %s", error->message);
+ g_error_free (error);
+ return;
+ }
+
+ GtkLockButton * button = GTK_LOCK_BUTTON (user_data);
+ gtk_lock_button_set_permission (button, permission);
}
static void
@@ -594,21 +620,6 @@ key_pressed (GtkWidget * widget, GdkEventKey * event, gpointer user_data)
}
static GtkWidget *
-get_child_of_type (GtkContainer * parent, GType type)
-{
- GList * children, * iter;
-
- children = gtk_container_get_children (parent);
- for (iter = children; iter; iter = iter->next) {
- if (G_TYPE_CHECK_INSTANCE_TYPE (iter->data, type)) {
- return GTK_WIDGET (iter->data);
- }
- }
-
- return NULL;
-}
-
-static GtkWidget *
create_dialog (void)
{
GError * error = NULL;
@@ -629,15 +640,17 @@ create_dialog (void)
#define WIG(name) GTK_WIDGET (gtk_builder_get_object (builder, name))
/* Add policykit button */
- GtkWidget * polkit_button = polkit_lock_button_new ("org.gnome.settingsdaemon.datetimemechanism.configure");
- polkit_lock_button_set_unlock_text (POLKIT_LOCK_BUTTON (polkit_button), _("Unlock to change these settings"));
- polkit_lock_button_set_lock_text (POLKIT_LOCK_BUTTON (polkit_button), _("Lock to prevent further changes"));
- gtk_box_pack_start (GTK_BOX (WIG ("timeDateBox")), polkit_button, FALSE, TRUE, 0);
- /* Make sure border around button is visible */
- GtkWidget * polkit_button_button = get_child_of_type (GTK_CONTAINER (polkit_button), GTK_TYPE_BUTTON);
- if (polkit_button_button != NULL) {
- gtk_button_set_relief (GTK_BUTTON (polkit_button_button), GTK_RELIEF_NORMAL);
- }
+ GtkWidget * polkit_button = gtk_lock_button_new (NULL);
+ g_object_set (G_OBJECT (polkit_button),
+ "text-unlock", _("Unlock to change these settings"),
+ "text-lock", _("Lock to prevent further changes"),
+ NULL);
+ GtkWidget * alignment = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
+ gtk_container_add (GTK_CONTAINER (alignment), polkit_button);
+ gtk_box_pack_start (GTK_BOX (WIG ("timeDateBox")), alignment, FALSE, TRUE, 0);
+
+ const gchar * polkit_name = "org.gnome.settingsdaemon.datetimemechanism.configure";
+ polkit_permission_new (polkit_name, NULL, NULL, polkit_perm_ready, polkit_button);
/* Add map */
tzmap = cc_timezone_map_new ();
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c
index 1c05ff0..800fa87 100644
--- a/src/indicator-datetime.c
+++ b/src/indicator-datetime.c
@@ -270,7 +270,7 @@ static void
menu_visible_notfy_cb(GtkWidget * menu, G_GNUC_UNUSED GParamSpec *pspec, gpointer user_data)
{
IndicatorDatetime * self = INDICATOR_DATETIME(user_data);
- g_debug("notify visible signal recieved");
+ g_debug("notify visible signal received");
// we should only react if we're currently visible
gboolean visible;
@@ -1077,7 +1077,7 @@ guess_label_size (IndicatorDatetime * self)
GArray * timevals = g_array_new(FALSE, TRUE, sizeof(struct tm));
build_timeval_array(timevals, posibilitymask);
- g_debug("Checking against %d posible times", timevals->len);
+ g_debug("Checking against %d possible times", timevals->len);
gint check_time;
for (check_time = 0; check_time < timevals->len; check_time++) {
gchar longstr[256];
@@ -1285,6 +1285,13 @@ new_appointment_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbu
/* Label, probably a username, chat room or mailbox name */
mi_data->label = gtk_label_new(dbusmenu_menuitem_property_get(newitem, APPOINTMENT_MENUITEM_PROP_LABEL));
gtk_misc_set_alignment(GTK_MISC(mi_data->label), 0.0, 0.5);
+
+ GtkStyle * style = gtk_widget_get_style(GTK_WIDGET(mi_data->label));
+ PangoContext * context = gtk_widget_get_pango_context(GTK_WIDGET(mi_data->label));
+ gint length = measure_string(style, context, "MMMMMMMMMMMMMMM"); // 15 char wide string max
+ gtk_widget_set_size_request(GTK_WIDGET(mi_data->label), length, -1); // Set the min size in pixels
+
+ gtk_label_set_ellipsize(GTK_LABEL(mi_data->label), PANGO_ELLIPSIZE_END);
gtk_box_pack_start(GTK_BOX(hbox), mi_data->label, TRUE, TRUE, 0);
gtk_widget_show(mi_data->label);
diff --git a/src/timezone-completion.c b/src/timezone-completion.c
index 7dcc28e..6ba1e88 100644
--- a/src/timezone-completion.c
+++ b/src/timezone-completion.c
@@ -455,9 +455,9 @@ find_popup_treeview (GtkWidget * widget, GtkTreeModel * model)
static gboolean
entry_keypress (GtkEntry * entry, GdkEventKey *event, TimezoneCompletion * completion)
{
- if (event->keyval == GDK_ISO_Enter ||
- event->keyval == GDK_KP_Enter ||
- event->keyval == GDK_Return) {
+ if (event->keyval == GDK_KEY_ISO_Enter ||
+ event->keyval == GDK_KEY_KP_Enter ||
+ event->keyval == GDK_KEY_Return) {
/* Make sure that user has a selection to choose, otherwise ignore */
GtkTreeModel * model = gtk_entry_completion_get_model (GTK_ENTRY_COMPLETION (completion));
GtkTreeView * view = find_popup_treeview (GTK_WIDGET (entry), model);