aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dialog.c6
-rw-r--r--src/indicator-session.c11
-rw-r--r--src/user-widget.c56
3 files changed, 36 insertions, 37 deletions
diff --git a/src/dialog.c b/src/dialog.c
index c46ac80..7c562d5 100644
--- a/src/dialog.c
+++ b/src/dialog.c
@@ -227,12 +227,6 @@ logout_dialog_new (LogoutDialogType type)
NULL);
}
- if (type == LOGOUT_DIALOG_TYPE_SHUTDOWN) {
- const gchar * restart_text;
- restart_text = g_dpgettext2 (NULL, "button", button_strings[LOGOUT_DIALOG_TYPE_RESTART]);
- gtk_dialog_add_button (GTK_DIALOG(dialog), restart_text, GTK_RESPONSE_HELP);
- }
-
gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK);
/* The following is a workaround to fix an issue in GtkMessageDialog
diff --git a/src/indicator-session.c b/src/indicator-session.c
index 53ff87e..3038948 100644
--- a/src/indicator-session.c
+++ b/src/indicator-session.c
@@ -36,7 +36,6 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <libindicator/indicator.h>
#include <libindicator/indicator-object.h>
#include <libindicator/indicator-service-manager.h>
-#include <libindicator/indicator-image-helper.h>
#include "shared-names.h"
#include "user-widget.h"
@@ -117,6 +116,8 @@ indicator_session_class_init (IndicatorSessionClass *klass)
static void
indicator_session_init (IndicatorSession *self)
{
+ const gchar * icon_name;
+
self->settings = g_settings_new ("com.canonical.indicator.session");
/* Now let's fire these guys up. */
@@ -131,9 +132,8 @@ indicator_session_init (IndicatorSession *self)
self->entry.name_hint = PACKAGE;
self->entry.accessible_desc = _("Session Menu");
self->entry.label = GTK_LABEL (gtk_label_new ("User Name"));
- self->entry.image = greeter_mode
- ? indicator_image_helper (GREETER_ICON_DEFAULT)
- : indicator_image_helper (ICON_DEFAULT);
+ icon_name = greeter_mode ? GREETER_ICON_DEFAULT : ICON_DEFAULT;
+ self->entry.image = GTK_IMAGE (gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON));
self->entry.menu = GTK_MENU (dbusmenu_gtkmenu_new(INDICATOR_SESSION_DBUS_NAME,
INDICATOR_SESSION_DBUS_OBJECT));
g_settings_bind (self->settings, "show-real-name-on-panel",
@@ -341,7 +341,8 @@ receive_signal (GDBusProxy * proxy,
}
else if (!g_strcmp0(signal_name, "RestartRequired"))
{
- indicator_image_helper_update (self->entry.image, greeter_mode ? GREETER_ICON_RESTART : ICON_RESTART);
+ const gchar * icon_name = greeter_mode ? GREETER_ICON_RESTART : ICON_RESTART;
+ gtk_image_set_from_icon_name (GTK_IMAGE(self->entry.image), icon_name, GTK_ICON_SIZE_MENU);
self->entry.accessible_desc = _("Device Menu (reboot required)");
g_signal_emit (G_OBJECT(self), INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE_ID, 0, &self->entry);
}
diff --git a/src/user-widget.c b/src/user-widget.c
index b0d2dd4..79b87b0 100644
--- a/src/user-widget.c
+++ b/src/user-widget.c
@@ -89,9 +89,8 @@ user_widget_init (UserWidget *self)
// Create the UI elements.
priv->user_image = gtk_image_new ();
gtk_misc_set_alignment(GTK_MISC(priv->user_image), 0.0, 0.0);
- gtk_misc_set_padding (GTK_MISC(priv->user_image),0, 4.0);
- priv->user_name = gtk_label_new ("");
+ priv->user_name = gtk_label_new (NULL);
priv->container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
@@ -180,40 +179,43 @@ user_widget_primitive_draw_cb_gtk_3 (GtkWidget *widget,
****
***/
-static const int ICON_SIZE = 24;
-
static void
update_icon (UserWidget * self, DbusmenuMenuitem * mi)
{
- GdkPixbuf * pixbuf = NULL;
+ gboolean updated = FALSE;
+ GtkImage * image = GTK_IMAGE(self->priv->user_image);
- /* first, try the menuitem's icon property */
+ /* first try the menuitem's icon property */
const gchar * icon_name = dbusmenu_menuitem_property_get (mi, USER_ITEM_PROP_ICON);
- if (icon_name)
+ if (icon_name != NULL)
{
- GError* error = NULL;
- pixbuf = gdk_pixbuf_new_from_file_at_size (icon_name, ICON_SIZE, ICON_SIZE, &error);
- if (error != NULL)
+ int width = 18; /* arbitrary default values */
+ int height = 18;
+ GError * err = NULL;
+ GdkPixbuf * pixbuf = NULL;
+
+ /* load the image */
+ gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &width, &height);
+ pixbuf = gdk_pixbuf_new_from_file_at_size (icon_name, width, height, &err);
+ if (err == NULL)
{
- g_warning ("Couldn't load the image \"%s\": %s", icon_name, error->message);
- g_clear_error (&error);
+ gtk_image_set_from_pixbuf (image, pixbuf);
+ g_object_unref (pixbuf);
+ updated = TRUE;
+ }
+ else
+ {
+ g_warning ("Couldn't load the image \"%s\": %s", icon_name, err->message);
+ g_clear_error (&err);
}
}
- /* as a fallback, try to use the default user icon */
- if (pixbuf == NULL)
- {
- pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
- USER_ITEM_ICON_DEFAULT,
- ICON_SIZE,
- GTK_ICON_LOOKUP_FORCE_SIZE,
- NULL);
- }
-
- if (pixbuf != NULL)
+ /* as a fallback, use the default user icon */
+ if (!updated)
{
- gtk_image_set_from_pixbuf (GTK_IMAGE(self->priv->user_image), pixbuf);
- g_object_unref (pixbuf);
+ gtk_image_set_from_icon_name (image,
+ USER_ITEM_ICON_DEFAULT,
+ GTK_ICON_SIZE_MENU);
}
}
@@ -277,7 +279,9 @@ user_widget_set_twin_item (UserWidget * self, DbusmenuMenuitem * mi)
/**
* user_widget_new:
- * @returns: a new #UserWidget.
+ * @item: the #DbusmenuMenuitem this widget will render.
+ *
+ * Returns: (transfer full): a new #UserWidget.
**/
GtkWidget*
user_widget_new (DbusmenuMenuitem *item)