aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-08-18 10:54:40 -0500
committerTed Gould <ted@gould.cx>2011-08-18 10:54:40 -0500
commit24ffe8bef8d2b482034354e9a2a9bb629f1bcfff (patch)
tree3f8bdba07858aba75454015db85d15939fcf93de /src
parent6deeec596bef04ffaf469dfcf5197b36b41813cf (diff)
parenta0c9e6000b9e96da5f663ac5fe47bcca8af13696 (diff)
downloadayatana-indicator-messages-24ffe8bef8d2b482034354e9a2a9bb629f1bcfff.tar.gz
ayatana-indicator-messages-24ffe8bef8d2b482034354e9a2a9bb629f1bcfff.tar.bz2
ayatana-indicator-messages-24ffe8bef8d2b482034354e9a2a9bb629f1bcfff.zip
Import upstream version 0.4.94
Diffstat (limited to 'src')
-rw-r--r--src/indicator-messages.c61
-rw-r--r--src/status-provider-emesene.c12
2 files changed, 61 insertions, 12 deletions
diff --git a/src/indicator-messages.c b/src/indicator-messages.c
index 82a9315..f2baf83 100644
--- a/src/indicator-messages.c
+++ b/src/indicator-messages.c
@@ -416,12 +416,18 @@ application_prop_change_cb (DbusmenuMenuitem * mi, gchar * prop, GVariant * valu
}
/* Draws a triangle on the left, using fg[STATE_TYPE] color. */
+#if GTK_CHECK_VERSION(3, 0, 0)
+static gboolean
+application_triangle_draw_cb (GtkWidget *widget, cairo_t *cr, gpointer data)
+{
+#else
static gboolean
application_triangle_draw_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
+ cairo_t *cr;
+#endif
GtkAllocation allocation;
GtkStyle *style;
- cairo_t *cr;
int x, y, arrow_width, arrow_height;
if (!GTK_IS_WIDGET (widget)) return FALSE;
@@ -438,13 +444,22 @@ application_triangle_draw_cb (GtkWidget *widget, GdkEventExpose *event, gpointer
arrow_width = 5; /* the pixel-based reference triangle is 5x9 */
arrow_height = 9;
gtk_widget_get_allocation (widget, &allocation);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ x = 0;
+ y = allocation.height/2.0 - (double)arrow_height/2.0;
+#else
x = allocation.x;
y = allocation.y + allocation.height/2.0 - (double)arrow_height/2.0;
+#endif
+#if GTK_CHECK_VERSION(3, 0, 0)
+ cairo_save (cr);
+#else
/* initialize cairo drawing area */
cr = (cairo_t*) gdk_cairo_create (gtk_widget_get_window (widget));
+#endif
- /* set line width */
+ /* set line width */
cairo_set_line_width (cr, 1.0);
/* cairo drawing code */
@@ -457,8 +472,12 @@ application_triangle_draw_cb (GtkWidget *widget, GdkEventExpose *event, gpointer
style->fg[gtk_widget_get_state(widget)].blue/65535.0);
cairo_fill (cr);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ cairo_restore (cr);
+#else
/* remember to destroy cairo context to avoid leaks */
cairo_destroy (cr);
+#endif
return FALSE;
}
@@ -478,12 +497,18 @@ custom_cairo_rounded_rectangle (cairo_t *cr,
}
/* Draws a rounded rectangle with text inside. */
+#if GTK_CHECK_VERSION(3, 0, 0)
+static gboolean
+numbers_draw_cb (GtkWidget *widget, cairo_t *cr, gpointer data)
+{
+#else
static gboolean
numbers_draw_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
+ cairo_t *cr;
+#endif
GtkAllocation allocation;
GtkStyle *style;
- cairo_t *cr;
double x, y, w, h;
PangoLayout * layout;
gint font_size = RIGHT_LABEL_FONT_SIZE;
@@ -495,10 +520,15 @@ numbers_draw_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
/* set arrow position / dimensions */
gtk_widget_get_allocation (widget, &allocation);
- w = allocation.width;
- h = allocation.height;
+#if GTK_CHECK_VERSION(3, 0, 0)
+ x = 0;
+ y = 0;
+#else
x = allocation.x;
y = allocation.y;
+#endif
+ w = allocation.width;
+ h = allocation.height;
layout = gtk_label_get_layout (GTK_LABEL(widget));
@@ -508,10 +538,14 @@ numbers_draw_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
/* const PangoFontDescription * font_description = pango_layout_get_font_description (layout);
font_size = pango_font_description_get_size (font_description); */
+#if GTK_CHECK_VERSION(3, 0, 0)
+ cairo_save (cr);
+#else
/* initialize cairo drawing area */
cr = (cairo_t*) gdk_cairo_create (gtk_widget_get_window (widget));
+#endif
- /* set line width */
+ /* set line width */
cairo_set_line_width (cr, 1.0);
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
@@ -527,8 +561,12 @@ numbers_draw_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
pango_cairo_layout_path (cr, layout);
cairo_fill (cr);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ cairo_restore (cr);
+#else
/* remember to destroy cairo context to avoid leaks */
- cairo_destroy (cr);
+ cairo_destroy (cr);
+#endif
return TRUE;
}
@@ -577,7 +615,11 @@ new_application_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbu
/* Make sure we can handle the label changing */
g_signal_connect(G_OBJECT(newitem), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(application_prop_change_cb), label);
g_signal_connect(G_OBJECT(newitem), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(application_icon_change_cb), icon);
+#if GTK_CHECK_VERSION(3, 0, 0)
+ g_signal_connect_after(G_OBJECT (gmi), "draw", G_CALLBACK (application_triangle_draw_cb), newitem);
+#else
g_signal_connect_after(G_OBJECT (gmi), "expose_event", G_CALLBACK (application_triangle_draw_cb), newitem);
+#endif
return TRUE;
}
@@ -710,8 +752,13 @@ new_indicator_item (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusm
mi_data->right = gtk_label_new(dbusmenu_menuitem_property_get(newitem, INDICATOR_MENUITEM_PROP_RIGHT));
gtk_size_group_add_widget(indicator_right_group, mi_data->right);
/* install extra decoration overlay */
+#if GTK_CHECK_VERSION(3, 0, 0)
+ g_signal_connect (G_OBJECT (mi_data->right), "draw",
+ G_CALLBACK (numbers_draw_cb), NULL);
+#else
g_signal_connect (G_OBJECT (mi_data->right), "expose_event",
G_CALLBACK (numbers_draw_cb), NULL);
+#endif
gtk_misc_set_alignment(GTK_MISC(mi_data->right), 1.0, 0.5);
gtk_box_pack_start(GTK_BOX(hbox), mi_data->right, FALSE, FALSE, padding + font_size/2.0);
diff --git a/src/status-provider-emesene.c b/src/status-provider-emesene.c
index 29a8a22..5aa6698 100644
--- a/src/status-provider-emesene.c
+++ b/src/status-provider-emesene.c
@@ -31,25 +31,27 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
typedef enum {
EM_STATUS_ONLINE,
- EM_STATUS_OFFLINE,
+ EM_STATUS_INVISIBLE,
EM_STATUS_BUSY,
EM_STATUS_AWAY,
- EM_STATUS_IDLE
+ EM_STATUS_IDLE,
+ EM_STATUS_OFFLINE
} em_status_t;
static const StatusProviderStatus em_to_sp_map[] = {
/* EM_STATUS_ONLINE, */ STATUS_PROVIDER_STATUS_ONLINE,
- /* EM_STATUS_OFFLINE, */ STATUS_PROVIDER_STATUS_OFFLINE,
+ /* EM_STATUS_INVISIBLE, */ STATUS_PROVIDER_STATUS_INVISIBLE,
/* EM_STATUS_BUSY, */ STATUS_PROVIDER_STATUS_DND,
/* EM_STATUS_AWAY, */ STATUS_PROVIDER_STATUS_AWAY,
- /* EM_STATUS_IDLE, */ STATUS_PROVIDER_STATUS_AWAY
+ /* EM_STATUS_IDLE, */ STATUS_PROVIDER_STATUS_AWAY,
+ /* EM_STATUS_OFFLINE, */ STATUS_PROVIDER_STATUS_OFFLINE
};
static const em_status_t sp_to_em_map[STATUS_PROVIDER_STATUS_LAST] = {
/* STATUS_PROVIDER_STATUS_ONLINE, */ EM_STATUS_ONLINE,
/* STATUS_PROVIDER_STATUS_AWAY, */ EM_STATUS_AWAY,
/* STATUS_PROVIDER_STATUS_DND */ EM_STATUS_BUSY,
- /* STATUS_PROVIDER_STATUS_INVISIBLE*/ EM_STATUS_OFFLINE,
+ /* STATUS_PROVIDER_STATUS_INVISIBLE*/ EM_STATUS_INVISIBLE,
/* STATUS_PROVIDER_STATUS_OFFLINE */ EM_STATUS_OFFLINE,
/* STATUS_PROVIDER_STATUS_DISCONNECTED*/ EM_STATUS_OFFLINE
};