aboutsummaryrefslogtreecommitdiff
path: root/tests/im-client.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/im-client.c')
-rw-r--r--tests/im-client.c46
1 files changed, 39 insertions, 7 deletions
diff --git a/tests/im-client.c b/tests/im-client.c
index db04b8e..3419a9d 100644
--- a/tests/im-client.c
+++ b/tests/im-client.c
@@ -23,6 +23,36 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include "libindicate/server.h"
#include "libindicate/indicator-message.h"
+gchar * patha = "/usr/share/icons/hicolor/16x16/apps/empathy.png";
+gchar * pathb = "/usr/share/icons/hicolor/22x22/apps/empathy.png";
+gchar * lastpath = NULL;
+
+static gboolean
+timeout_cb (gpointer data)
+{
+ g_debug("Modifying properties");
+
+ IndicateIndicator * indicator = INDICATE_INDICATOR(data);
+
+ GTimeVal time;
+ g_get_current_time(&time);
+ indicate_indicator_set_property_time(INDICATE_INDICATOR(indicator), "time", &time);
+
+ if (lastpath == patha) {
+ lastpath = pathb;
+ } else {
+ lastpath = patha;
+ }
+
+ GdkPixbuf * pixbuf = gdk_pixbuf_new_from_file(lastpath, NULL);
+ g_return_val_if_fail(pixbuf != NULL, TRUE);
+
+ indicate_indicator_set_property_icon(INDICATE_INDICATOR(indicator), "icon", pixbuf);
+ g_object_unref(G_OBJECT(pixbuf));
+
+ return TRUE;
+}
+
static void
display (IndicateIndicator * indicator, gpointer data)
{
@@ -35,23 +65,25 @@ main (int argc, char ** argv)
g_type_init();
IndicateServer * server = indicate_server_ref_default();
- GValue value = {0};
- g_value_init(&value, G_TYPE_STRING);
- g_value_set_static_string(&value, "message.im");
- g_object_set_property(G_OBJECT(server), "type", &value);
+ indicate_server_set_type(server, "message.im");
+ indicate_server_set_desktop_file(server, "/usr/share/applications/empathy.desktop");
IndicateIndicatorMessage * indicator;
indicator = indicate_indicator_message_new();
indicate_indicator_set_property(INDICATE_INDICATOR(indicator), "subtype", "im");
- indicate_indicator_set_property(INDICATE_INDICATOR(indicator), "sender", "Ted Gould");
- indicate_indicator_set_property(INDICATE_INDICATOR(indicator), "time", "11:11");
+ indicate_indicator_set_property(INDICATE_INDICATOR(indicator), "sender", "IM Client Test");
+ GTimeVal time; g_get_current_time(&time);
+ indicate_indicator_set_property_time(INDICATE_INDICATOR(indicator), "time", &time);
indicate_indicator_show(INDICATE_INDICATOR(indicator));
- indicate_indicator_set_property(INDICATE_INDICATOR(indicator), "time", "11:12");
+ g_get_current_time(&time);
+ indicate_indicator_set_property_time(INDICATE_INDICATOR(indicator), "time", &time);
g_signal_connect(G_OBJECT(indicator), INDICATE_INDICATOR_SIGNAL_DISPLAY, G_CALLBACK(display), NULL);
+ g_timeout_add_seconds(180, timeout_cb, indicator);
+
g_main_loop_run(g_main_loop_new(NULL, FALSE));
return 0;