diff options
| author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2014-02-14 13:06:15 +0100 |
|---|---|---|
| committer | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2014-02-17 20:15:49 +0100 |
| commit | c4bd6363df9dfb3199d80542c6f19159cca1ffe1 (patch) | |
| tree | 38fe31ebe7f1544895bb0d3e0f18b7e839c35cd2 /shell/app-icon.c | |
| parent | a3b3d15a3d3acc3df39615ead685dafcb9371650 (diff) | |
| download | graynard-c4bd6363df9dfb3199d80542c6f19159cca1ffe1.tar.gz graynard-c4bd6363df9dfb3199d80542c6f19159cca1ffe1.zip | |
app-icon: add new widget subclass for icons on the panel
Diffstat (limited to 'shell/app-icon.c')
| -rw-r--r-- | shell/app-icon.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/shell/app-icon.c b/shell/app-icon.c new file mode 100644 index 0000000..e53320a --- /dev/null +++ b/shell/app-icon.c @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2014 Collabora Ltd. + * + * Author: Jonny Lamb <jonny.lamb@collabora.co.uk> + */ + +#include "config.h" + +#include "app-icon.h" + +G_DEFINE_TYPE(WestonGtkAppIcon, weston_gtk_app_icon, GTK_TYPE_BUTTON) + +static void +weston_gtk_app_icon_init (WestonGtkAppIcon *self) +{ + gtk_style_context_add_class ( + gtk_widget_get_style_context (GTK_WIDGET (self)), + "wgs-apps"); + + gtk_style_context_remove_class ( + gtk_widget_get_style_context (GTK_WIDGET (self)), + "button"); + gtk_style_context_remove_class ( + gtk_widget_get_style_context (GTK_WIDGET (self)), + "image-button"); + + gtk_button_set_relief (GTK_BUTTON (self), GTK_RELIEF_NONE); +} + +static void +weston_gtk_app_icon_class_init (WestonGtkAppIconClass *klass) +{ +} + +GtkWidget * +weston_gtk_app_icon_new (const gchar *icon_name) +{ + GtkWidget *widget; + GtkWidget *image; + + image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_DIALOG); + widget = g_object_new (WESTON_GTK_APP_ICON_TYPE, + "image", image, + NULL); + + return widget; +} + +GtkWidget * +weston_gtk_app_icon_new_from_gicon (GIcon *icon) +{ + GtkWidget *widget, *image; + + image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_DIALOG); + + widget = g_object_new (WESTON_GTK_APP_ICON_TYPE, + "image", image, + NULL); + + return widget; +} |
