diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2013-03-26 15:14:33 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2013-03-26 15:14:33 -0500 |
commit | 2d8eac6ae37a5615c846953410e1576faf5bc677 (patch) | |
tree | 91fdb6f47241a9dda3abf9fa5a6dfc2dfe773480 /src | |
parent | bf3b14f5c5105c63816b9555dffb3bf3e273c602 (diff) | |
download | ayatana-ido-2d8eac6ae37a5615c846953410e1576faf5bc677.tar.gz ayatana-ido-2d8eac6ae37a5615c846953410e1576faf5bc677.tar.bz2 ayatana-ido-2d8eac6ae37a5615c846953410e1576faf5bc677.zip |
rename user-widget.[ch] to idousermenuitem.[ch]. Not building yet, next step is to decouple from dbusmenu.
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/idousermenuitem.c (renamed from src/user-widget.c) | 43 | ||||
-rw-r--r-- | src/idousermenuitem.h | 55 | ||||
-rw-r--r-- | src/user-widget.h | 55 |
4 files changed, 77 insertions, 78 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index e14efbf..6e1d813 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -17,6 +17,7 @@ sources_h = \ idorange.h \ idoscalemenuitem.h \ idoswitchmenuitem.h \ + idousermenuitem.h \ idotimeline.h \ libido.h @@ -66,6 +67,7 @@ libido_0_1_la_SOURCES = \ idorange.c \ idoscalemenuitem.c \ idoswitchmenuitem.c \ + idousermenuitem.c \ idotimeline.c libido3_0_1_la_SOURCES = $(libido_0_1_la_SOURCES) diff --git a/src/user-widget.c b/src/idousermenuitem.c index 79b87b0..620df8d 100644 --- a/src/user-widget.c +++ b/src/idousermenuitem.c @@ -25,15 +25,12 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <gtk/gtk.h> -#include <libindicator/indicator-image-helper.h> +#include "idousermenuitem.h" -#include "shared-names.h" -#include "user-widget.h" +typedef struct _IdoUserMenuItemPrivate IdoUserMenuItemPrivate; -typedef struct _UserWidgetPrivate UserWidgetPrivate; - -struct _UserWidgetPrivate +struct _IdoUserMenuItemPrivate { DbusmenuMenuitem* twin_item; GtkWidget* user_image; @@ -44,40 +41,40 @@ struct _UserWidgetPrivate gboolean sessions_active; }; -#define USER_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), USER_WIDGET_TYPE, UserWidgetPrivate)) +#define USER_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), USER_WIDGET_TYPE, IdoUserMenuItemPrivate)) /* Prototypes */ -static void user_widget_class_init (UserWidgetClass *klass); -static void user_widget_init (UserWidget *self); +static void user_widget_class_init (IdoUserMenuItemClass *klass); +static void user_widget_init (IdoUserMenuItem *self); static void user_widget_dispose (GObject *object); static void user_widget_finalize (GObject *object); -static void user_widget_set_twin_item (UserWidget* self, +static void user_widget_set_twin_item (IdoUserMenuItem* self, DbusmenuMenuitem* twin_item); static gboolean user_widget_primitive_draw_cb_gtk_3 (GtkWidget *image, cairo_t* cr, gpointer user_data); -G_DEFINE_TYPE (UserWidget, user_widget, GTK_TYPE_MENU_ITEM); +G_DEFINE_TYPE (IdoUserMenuItem, user_widget, GTK_TYPE_MENU_ITEM); static void -user_widget_class_init (UserWidgetClass *klass) +user_widget_class_init (IdoUserMenuItemClass *klass) { GObjectClass * gobject_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (klass, sizeof (UserWidgetPrivate)); + g_type_class_add_private (klass, sizeof (IdoUserMenuItemPrivate)); gobject_class->dispose = user_widget_dispose; gobject_class->finalize = user_widget_finalize; } static void -user_widget_init (UserWidget *self) +user_widget_init (IdoUserMenuItem *self) { self->priv = USER_WIDGET_GET_PRIVATE(self); - UserWidgetPrivate * priv = self->priv; + IdoUserMenuItemPrivate * priv = self->priv; priv->user_image = NULL; priv->user_name = NULL; @@ -150,8 +147,8 @@ user_widget_primitive_draw_cb_gtk_3 (GtkWidget *widget, gpointer user_data) { g_return_val_if_fail(IS_USER_WIDGET(user_data), FALSE); - UserWidget* meta = USER_WIDGET(user_data); - UserWidgetPrivate * priv = USER_WIDGET_GET_PRIVATE(meta); + IdoUserMenuItem* meta = USER_WIDGET(user_data); + IdoUserMenuItemPrivate * priv = USER_WIDGET_GET_PRIVATE(meta); // Draw dot only when user is the current user. if (dbusmenu_menuitem_property_get_bool (priv->twin_item, USER_ITEM_PROP_IS_CURRENT_USER)) @@ -180,7 +177,7 @@ user_widget_primitive_draw_cb_gtk_3 (GtkWidget *widget, ***/ static void -update_icon (UserWidget * self, DbusmenuMenuitem * mi) +update_icon (IdoUserMenuItem * self, DbusmenuMenuitem * mi) { gboolean updated = FALSE; GtkImage * image = GTK_IMAGE(self->priv->user_image); @@ -220,7 +217,7 @@ update_icon (UserWidget * self, DbusmenuMenuitem * mi) } static void -update_logged_in (UserWidget * self, DbusmenuMenuitem * mi) +update_logged_in (IdoUserMenuItem * self, DbusmenuMenuitem * mi) { const gboolean b = dbusmenu_menuitem_property_get_bool (mi, USER_ITEM_PROP_LOGGED_IN); @@ -232,7 +229,7 @@ update_logged_in (UserWidget * self, DbusmenuMenuitem * mi) } static void -update_name (UserWidget * self, DbusmenuMenuitem * mi) +update_name (IdoUserMenuItem * self, DbusmenuMenuitem * mi) { gtk_label_set_label (GTK_LABEL(self->priv->user_name), dbusmenu_menuitem_property_get (mi, USER_ITEM_PROP_NAME)); @@ -242,7 +239,7 @@ static void user_widget_property_update (DbusmenuMenuitem * mi, const gchar * property, GVariant * value, - UserWidget * self) + IdoUserMenuItem * self) { g_return_if_fail (IS_USER_WIDGET (self)); @@ -265,7 +262,7 @@ user_widget_property_update (DbusmenuMenuitem * mi, } static void -user_widget_set_twin_item (UserWidget * self, DbusmenuMenuitem * mi) +user_widget_set_twin_item (IdoUserMenuItem * self, DbusmenuMenuitem * mi) { self->priv->twin_item = mi; @@ -281,7 +278,7 @@ user_widget_set_twin_item (UserWidget * self, DbusmenuMenuitem * mi) * user_widget_new: * @item: the #DbusmenuMenuitem this widget will render. * - * Returns: (transfer full): a new #UserWidget. + * Returns: (transfer full): a new #IdoUserMenuItem. **/ GtkWidget* user_widget_new (DbusmenuMenuitem *item) diff --git a/src/idousermenuitem.h b/src/idousermenuitem.h new file mode 100644 index 0000000..ac115a8 --- /dev/null +++ b/src/idousermenuitem.h @@ -0,0 +1,55 @@ +/* +Copyright 2011 Canonical Ltd. + +Authors: + Conor Curran <conor.curran@canonical.com> + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published +by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see <http://www.gnu.org/licenses/>. +*/ +#ifndef __IDO_USER_MENU_ITEM_H__ +#define __IDO_USER_MENU_ITEM_H__ + +#include <gtk/gtk.h> +#include <libdbusmenu-gtk/menuitem.h> + +G_BEGIN_DECLS + +#define IDO_USER_MENU_ITEM_TYPE (ido_user_menu_item_get_type ()) +#define IDO_USER_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), IDO_USER_MENU_ITEM_TYPE, IdoUserMenuItem)) +#define IDO_USER_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), IDO_USER_MENU_ITEM_TYPE, IdoUserMenuItemClass)) +#define IS_IDO_USER_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IDO_USER_MENU_ITEM_TYPE)) +#define IS_IDO_USER_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), IDO_USER_MENU_ITEM_TYPE)) +#define IDO_USER_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), IDO_USER_MENU_ITEM_TYPE, IdoUserMenuItemClass)) + +typedef struct _IdoUserMenuItem IdoUserMenuItem; +typedef struct _IdoUserMenuItemClass IdoUserMenuItemClass; +typedef struct _IdoUserMenuItemPrivate IdoUserMenuItemPrivate; + +struct _IdoUserMenuItemClass +{ + GtkMenuItemClass parent_class; +}; + +struct _IdoUserMenuItem +{ + /*< private >*/ + GtkMenuItem parent; + IdoUserMenuItemPrivate * priv; +}; + +GType ido_user_menu_item_get_type (void) G_GNUC_CONST; +GtkWidget* ido_user_menu_item_new(DbusmenuMenuitem *twin_item); + +G_END_DECLS + +#endif diff --git a/src/user-widget.h b/src/user-widget.h deleted file mode 100644 index 0953e6c..0000000 --- a/src/user-widget.h +++ /dev/null @@ -1,55 +0,0 @@ -/* -Copyright 2011 Canonical Ltd. - -Authors: - Conor Curran <conor.curran@canonical.com> - -This program is free software: you can redistribute it and/or modify it -under the terms of the GNU General Public License version 3, as published -by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranties of -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR -PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program. If not, see <http://www.gnu.org/licenses/>. -*/ -#ifndef __USER_WIDGET_H__ -#define __USER_WIDGET_H__ - -#include <gtk/gtk.h> -#include <libdbusmenu-gtk/menuitem.h> - -G_BEGIN_DECLS - -#define USER_WIDGET_TYPE (user_widget_get_type ()) -#define USER_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), USER_WIDGET_TYPE, UserWidget)) -#define USER_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), USER_WIDGET_TYPE, UserWidgetClass)) -#define IS_USER_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), USER_WIDGET_TYPE)) -#define IS_USER_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), USER_WIDGET_TYPE)) -#define USER_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), USER_WIDGET_TYPE, UserWidgetClass)) - -typedef struct _UserWidget UserWidget; -typedef struct _UserWidgetClass UserWidgetClass; -typedef struct _UserWidgetPrivate UserWidgetPrivate; - -struct _UserWidgetClass -{ - GtkMenuItemClass parent_class; -}; - -struct _UserWidget -{ - /*< private >*/ - GtkMenuItem parent; - UserWidgetPrivate * priv; -}; - -GType user_widget_get_type (void) G_GNUC_CONST; -GtkWidget* user_widget_new(DbusmenuMenuitem *twin_item); - -G_END_DECLS - -#endif |