summaryrefslogtreecommitdiff
path: root/applets/notification_area/status-notifier
diff options
context:
space:
mode:
authorColomban Wendling <[email protected]>2017-01-20 11:03:03 +0100
committerlukefromdc <[email protected]>2017-01-23 13:49:34 -0500
commitda419c619744efc754e72df2e2101a32adca8a37 (patch)
tree37df54c88607741686a5e2a50a49b90811c021a2 /applets/notification_area/status-notifier
parent7d39b2e82f46777efa67224f078c1cec9e827654 (diff)
downloadmate-panel-da419c619744efc754e72df2e2101a32adca8a37.tar.bz2
mate-panel-da419c619744efc754e72df2e2101a32adca8a37.tar.xz
Lower GLib dependency
Diffstat (limited to 'applets/notification_area/status-notifier')
-rw-r--r--applets/notification_area/status-notifier/sn-dbus-menu.h15
-rw-r--r--applets/notification_area/status-notifier/sn-host-v0.h14
-rw-r--r--applets/notification_area/status-notifier/sn-image-menu-item.h16
-rw-r--r--applets/notification_area/status-notifier/sn-item-v0.h15
-rw-r--r--applets/notification_area/status-notifier/sn-item.c14
-rw-r--r--applets/notification_area/status-notifier/sn-item.h20
6 files changed, 74 insertions, 20 deletions
diff --git a/applets/notification_area/status-notifier/sn-dbus-menu.h b/applets/notification_area/status-notifier/sn-dbus-menu.h
index 39907d07..d92f8eb8 100644
--- a/applets/notification_area/status-notifier/sn-dbus-menu.h
+++ b/applets/notification_area/status-notifier/sn-dbus-menu.h
@@ -22,8 +22,19 @@
G_BEGIN_DECLS
-#define SN_TYPE_DBUS_MENU sn_dbus_menu_get_type ()
-G_DECLARE_FINAL_TYPE (SnDBusMenu, sn_dbus_menu, SN, DBUS_MENU, GtkMenu)
+#define SN_TYPE_DBUS_MENU (sn_dbus_menu_get_type ())
+#define SN_DBUS_MENU(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SN_TYPE_DBUS_MENU, SnDBusMenu))
+#define SN_IS_DBUS_MENU(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SN_TYPE_DBUS_MENU))
+
+typedef struct _SnDBusMenu SnDBusMenu;
+typedef struct _SnDBusMenuClass SnDBusMenuClass;
+
+struct _SnDBusMenuClass
+{
+ GtkMenuClass parent_class;
+};
+
+GType sn_dbus_menu_get_type (void);
GtkMenu *sn_dbus_menu_new (const gchar *bus_name,
const gchar *object_path);
diff --git a/applets/notification_area/status-notifier/sn-host-v0.h b/applets/notification_area/status-notifier/sn-host-v0.h
index 61c8b5c3..6681c111 100644
--- a/applets/notification_area/status-notifier/sn-host-v0.h
+++ b/applets/notification_area/status-notifier/sn-host-v0.h
@@ -23,9 +23,19 @@
G_BEGIN_DECLS
-#define SN_TYPE_HOST_V0 sn_host_v0_get_type ()
-G_DECLARE_FINAL_TYPE (SnHostV0, sn_host_v0, SN, HOST_V0, SnHostV0GenSkeleton)
+#define SN_TYPE_HOST_V0 (sn_host_v0_get_type ())
+#define SN_HOST_V0(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SN_TYPE_HOST_V0, SnHostV0))
+#define SN_IS_HOST_V0(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SN_TYPE_HOST_V0))
+typedef struct _SnHostV0 SnHostV0;
+typedef struct _SnHostV0Class SnHostV0Class;
+
+struct _SnHostV0Class
+{
+ SnHostV0GenSkeletonClass parent_class;
+};
+
+GType sn_host_v0_get_type (void);
NaHost *sn_host_v0_new (void);
G_END_DECLS
diff --git a/applets/notification_area/status-notifier/sn-image-menu-item.h b/applets/notification_area/status-notifier/sn-image-menu-item.h
index b0fe8a90..9aa9a4a1 100644
--- a/applets/notification_area/status-notifier/sn-image-menu-item.h
+++ b/applets/notification_area/status-notifier/sn-image-menu-item.h
@@ -22,9 +22,19 @@
G_BEGIN_DECLS
-#define SN_TYPE_IMAGE_MENU_ITEM sn_image_menu_item_get_type ()
-G_DECLARE_FINAL_TYPE (SnImageMenuItem, sn_image_menu_item,
- SN, IMAGE_MENU_ITEM, GtkMenuItem)
+#define SN_TYPE_IMAGE_MENU_ITEM (sn_image_menu_item_get_type ())
+#define SN_IMAGE_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SN_TYPE_IMAGE_MENU_ITEM, SnImageMenuItem))
+#define SN_IS_IMAGE_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SN_TYPE_IMAGE_MENU_ITEM))
+
+typedef struct _SnImageMenuItem SnImageMenuItem;
+typedef struct _SnImageMenuItemClass SnImageMenuItemClass;
+
+struct _SnImageMenuItemClass
+{
+ GtkMenuItemClass parent_class;
+};
+
+GType sn_image_menu_item_get_type (void);
GtkWidget *sn_image_menu_item_new (void);
diff --git a/applets/notification_area/status-notifier/sn-item-v0.h b/applets/notification_area/status-notifier/sn-item-v0.h
index 4b1bd492..548905e8 100644
--- a/applets/notification_area/status-notifier/sn-item-v0.h
+++ b/applets/notification_area/status-notifier/sn-item-v0.h
@@ -22,8 +22,19 @@
G_BEGIN_DECLS
-#define SN_TYPE_ITEM_V0 sn_item_v0_get_type ()
-G_DECLARE_FINAL_TYPE (SnItemV0, sn_item_v0, SN, ITEM_V0, SnItem)
+#define SN_TYPE_ITEM_V0 (sn_item_v0_get_type ())
+#define SN_ITEM_V0(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SN_TYPE_ITEM_V0, SnItemV0))
+#define SN_IS_ITEM_V0(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SN_TYPE_ITEM_V0))
+
+typedef struct _SnItemV0 SnItemV0;
+typedef struct _SnItemV0Class SnItemV0Class;
+
+struct _SnItemV0Class
+{
+ SnItemClass parent_class;
+};
+
+GType sn_item_v0_get_type (void);
SnItem *sn_item_v0_new (const gchar *bus_name,
const gchar *object_path);
diff --git a/applets/notification_area/status-notifier/sn-item.c b/applets/notification_area/status-notifier/sn-item.c
index 13ee68f3..9bd16314 100644
--- a/applets/notification_area/status-notifier/sn-item.c
+++ b/applets/notification_area/status-notifier/sn-item.c
@@ -22,7 +22,7 @@
#include "na-item.h"
-typedef struct
+struct _SnItemPrivate
{
gchar *bus_name;
gchar *object_path;
@@ -30,7 +30,7 @@ typedef struct
GtkOrientation orientation;
GtkMenu *menu;
-} SnItemPrivate;
+};
enum
{
@@ -56,18 +56,12 @@ static guint signals[LAST_SIGNAL] = { 0 };
static void na_item_init (NaItemInterface *iface);
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (SnItem, sn_item, GTK_TYPE_BUTTON,
- //~ G_ADD_PRIVATE (SnItem);
G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE,
NULL)
G_IMPLEMENT_INTERFACE (NA_TYPE_ITEM,
na_item_init))
-/* FIXME: apparently if requesting < 2.38, G_ADD_PRIVATE() or the default
- * sn_item_get_instance_private() does NOT work, and returns some garbage
- * (either get_instance_private() works but G_ADD_PRIVATE() didn't do nothing,
- * or the other way around, but it leads to using incorrect memory) */
-#define sn_item_get_instance_private(i) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((i), SN_TYPE_ITEM, SnItemPrivate))
+#define sn_item_get_instance_private(i) (SN_ITEM (i)->priv)
static void
sn_item_dispose (GObject *object)
@@ -461,6 +455,8 @@ sn_item_class_init (SnItemClass *item_class)
static void
sn_item_init (SnItem *item)
{
+ item->priv = G_TYPE_INSTANCE_GET_PRIVATE (item, SN_TYPE_ITEM, SnItemPrivate);
+
gtk_widget_add_events (GTK_WIDGET (item), GDK_SCROLL_MASK);
}
diff --git a/applets/notification_area/status-notifier/sn-item.h b/applets/notification_area/status-notifier/sn-item.h
index c414b942..de7de892 100644
--- a/applets/notification_area/status-notifier/sn-item.h
+++ b/applets/notification_area/status-notifier/sn-item.h
@@ -22,8 +22,12 @@
G_BEGIN_DECLS
-#define SN_TYPE_ITEM sn_item_get_type ()
-G_DECLARE_DERIVABLE_TYPE (SnItem, sn_item, SN, ITEM, GtkButton)
+#define SN_TYPE_ITEM (sn_item_get_type ())
+#define SN_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SN_TYPE_ITEM, SnItem))
+#define SN_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SN_TYPE_ITEM, SnItemClass))
+#define SN_IS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SN_TYPE_ITEM))
+#define SN_IS_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SN_TYPE_ITEM))
+#define SN_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SN_TYPE_ITEM, SnItemClass))
typedef enum
{
@@ -31,6 +35,17 @@ typedef enum
SN_ITEM_ORIENTATION_VERTICAL
} SnItemOrientation;
+typedef struct _SnItem SnItem;
+typedef struct _SnItemPrivate SnItemPrivate;
+typedef struct _SnItemClass SnItemClass;
+
+struct _SnItem
+{
+ GtkButtonClass parent_instance;
+
+ SnItemPrivate *priv;
+};
+
struct _SnItemClass
{
GtkButtonClass parent_class;
@@ -60,6 +75,7 @@ struct _SnItemClass
SnItemOrientation orientation);
};
+GType sn_item_get_type (void);
const gchar *sn_item_get_bus_name (SnItem *item);
const gchar *sn_item_get_object_path (SnItem *item);