From 12c23d62d0932bcecced3c2621674b89c4e6d265 Mon Sep 17 00:00:00 2001 From: Scott Balneaves Date: Wed, 26 Dec 2012 21:42:10 -0600 Subject: Fix deprecations and warnings --- polkitgtkmate/polkitlockbutton.c | 20 ++++++++++++++------ src/main.c | 4 +++- src/polkitmateauthenticationdialog.c | 1 + src/polkitmatelistener.c | 8 +++++++- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/polkitgtkmate/polkitlockbutton.c b/polkitgtkmate/polkitlockbutton.c index cedfa4d..079a94b 100644 --- a/polkitgtkmate/polkitlockbutton.c +++ b/polkitgtkmate/polkitlockbutton.c @@ -680,9 +680,9 @@ polkit_lock_button_new (const gchar *action_id) static void update_state (PolkitLockButton *button) { - const gchar *text; - const gchar *tooltip; - gboolean sensitive; + const gchar *text = NULL; + const gchar *tooltip = NULL; + gboolean sensitive = FALSE; gboolean old_hidden; GtkWidget *image; @@ -735,11 +735,19 @@ update_state (PolkitLockButton *button) image = gtk_image_new_from_icon_name (button->priv->authorized ? "changes-allow" : "changes-prevent", GTK_ICON_SIZE_SMALL_TOOLBAR); gtk_button_set_image (GTK_BUTTON (button->priv->button), image); - gtk_label_set_text (GTK_LABEL (button->priv->label), text); + + if (text != NULL) + { + gtk_label_set_text (GTK_LABEL (button->priv->label), text); + } + gtk_widget_set_sensitive (button->priv->button, sensitive); - gtk_widget_set_tooltip_markup (GTK_WIDGET (button->priv->label), tooltip); - gtk_widget_set_tooltip_markup (GTK_WIDGET (button->priv->button), tooltip); + if (tooltip != NULL) + { + gtk_widget_set_tooltip_markup (GTK_WIDGET (button->priv->label), tooltip); + gtk_widget_set_tooltip_markup (GTK_WIDGET (button->priv->button), tooltip); + } if (button->priv->hidden) { diff --git a/src/main.c b/src/main.c index a18dc13..c879993 100644 --- a/src/main.c +++ b/src/main.c @@ -248,9 +248,11 @@ main (int argc, char **argv) } error = NULL; - if (!polkit_agent_register_listener (listener, + if (!polkit_agent_listener_register (listener, + POLKIT_AGENT_REGISTER_FLAGS_NONE, session, "/org/mate/PolicyKit1/AuthenticationAgent", + NULL, &error)) { g_printerr ("Cannot register authentication agent: %s\n", error->message); diff --git a/src/polkitmateauthenticationdialog.c b/src/polkitmateauthenticationdialog.c index 0d39890..3f02b19 100644 --- a/src/polkitmateauthenticationdialog.c +++ b/src/polkitmateauthenticationdialog.c @@ -273,6 +273,7 @@ get_image (PolkitMateAuthenticationDialog *dialog) pixbuf = NULL; copy_pixbuf = NULL; vendor_pixbuf = NULL; + image = NULL; if (dialog->priv->icon_name == NULL || strlen (dialog->priv->icon_name) == 0) { diff --git a/src/polkitmatelistener.c b/src/polkitmatelistener.c index d70836f..1b7c486 100644 --- a/src/polkitmatelistener.c +++ b/src/polkitmatelistener.c @@ -27,6 +27,12 @@ #include "polkitmatelistener.h" #include "polkitmateauthenticator.h" +#ifdef __GNUC__ +#define UNUSED_VARIABLE __attribute__ ((unused)) +#else +#define UNUSED_VARIABLE +#endif + struct _PolkitMateListener { PolkitAgentListener parent_instance; @@ -67,7 +73,7 @@ polkit_mate_listener_init (PolkitMateListener *listener) static void polkit_mate_listener_finalize (GObject *object) { - PolkitMateListener *listener; + PolkitMateListener UNUSED_VARIABLE *listener; listener = POLKIT_MATE_LISTENER (object); -- cgit v1.2.1