~ubuntu-branches/ubuntu/natty/empathy/natty

« back to all changes in this revision

Viewing changes to debian/patches/40_libunity.patch

  • Committer: Bazaar Package Importer
  • Author(s): Brian Curtis, Brian Curtis, Ken VanDine
  • Date: 2011-02-14 17:28:40 UTC
  • Revision ID: james.westby@ubuntu.com-20110214172840-oo3ywi4030vud3cx
Tags: 2.33.1-0ubuntu3
[ Brian Curtis ]
* debian/patches/40_libunity.patch
  -add launcher support for empathy
* debian/changelog
  -add libunity-dev to deps

[ Ken VanDine ]
* debian/patches/40_libunity.patch
  - cleaned up some debugging messages
  - unref the launcher

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
=== modified file 'configure.ac'
 
2
--- old/configure.ac    2011-02-15 17:12:52 +0000
 
3
+++ new/configure.ac    2011-02-15 17:13:00 +0000
 
4
@@ -58,6 +58,7 @@
 
5
 GNOME_CONTROL_CENTER_GTK3_REQUIRED=2.31.4
 
6
 INDICATE_REQUIRED=0.4.91
 
7
 INDICATE_GTK_REQUIRED=0.4.91
 
8
+UNITY_REQUIRED=3.4.0
 
9
 
 
10
 AC_CONFIG_MACRO_DIR([m4])
 
11
 AC_CONFIG_HEADERS([config.h])
 
12
@@ -468,12 +469,41 @@
 
13
 fi
 
14
 
 
15
 if test "x$enable_libindicate" = "xyes" -a "x$have_libindicate" != "xyes"; then
 
16
-   AC_MSG_ERROR([Couldn't find libindicate.])
 
17
+   AC_MSG_ERROR([Could not find libindicate.])
 
18
 fi
 
19
 
 
20
 AM_CONDITIONAL(HAVE_LIBINDICATE, test "x$have_libindicate" = "xyes")
 
21
 
 
22
 # -----------------------------------------------------------
 
23
+# libunity
 
24
+# -----------------------------------------------------------
 
25
+AC_ARG_ENABLE(libunity,
 
26
+               AS_HELP_STRING([--enable-libunity=@<:@no/yes/auto@:>@],
 
27
+                       [build libunity support]), ,
 
28
+                       enable_libunity=auto)
 
29
+
 
30
+if test "x$enable_unity" != "xno"; then
 
31
+   PKG_CHECK_MODULES(UNITY,
 
32
+   [
 
33
+     unity >= $UNITY_REQUIRED
 
34
+   ], have_unity="yes", have_unity="no")
 
35
+
 
36
+   if test "x$have_unity" = "xyes"; then
 
37
+      AC_DEFINE(HAVE_UNITY, 1, [Define if you have unity])
 
38
+   fi
 
39
+else
 
40
+   have_unity=no
 
41
+fi
 
42
+
 
43
+if test "x$enable_unity" = "xyes" -a "x$have_unity" != "xyes"; then
 
44
+   AC_MSG_ERROR([Could not find libunity.])
 
45
+fi
 
46
+
 
47
+AM_CONDITIONAL(HAVE_UNITY, test "x$have_unity" = "xyes")
 
48
+AC_SUBST([UNITY_CFLAGS])
 
49
+AC_SUBST([UNITY_LIBS])
 
50
+
 
51
+# -----------------------------------------------------------
 
52
 # nautilus-sendto
 
53
 # -----------------------------------------------------------
 
54
 AC_ARG_ENABLE(nautilus-sendto,
 
55
@@ -576,6 +606,7 @@
 
56
 
 
57
     Features:
 
58
        Message indicator support (libindicate):  ${have_libindicate}
 
59
+       Unity panel support (unity).:  ${have_unity}
 
60
        Spell checking (enchant)....:  ${have_enchant}
 
61
        Display maps (libchamplain).:  ${have_libchamplain}
 
62
        Location awareness (Geoclue):  ${have_geoclue}
 
63
 
 
64
=== modified file 'src/Makefile.am'
 
65
--- old/src/Makefile.am 2011-02-15 17:12:08 +0000
 
66
+++ new/src/Makefile.am 2011-02-15 17:13:00 +0000
 
67
@@ -18,6 +18,7 @@
 
68
        $(CPPFLAGS_COMMON)                              \
 
69
        $(LIBNOTIFY_CFLAGS)                             \
 
70
        $(INDICATE_CFLAGS)                              \
 
71
+       $(UNITY_CFLAGS)                                 \
 
72
        $(UNIQUE_CFLAGS) \
 
73
        $(LIBCHAMPLAIN_CFLAGS)                          \
 
74
        $(WEBKIT_CFLAGS)                                \
 
75
@@ -29,6 +30,7 @@
 
76
        $(top_builddir)/extensions/libemp-extensions.la         \
 
77
        $(LIBNOTIFY_LIBS)                                       \
 
78
        $(INDICATE_LIBS)                                        \
 
79
+       $(UNITY_LIBS)                                           \
 
80
        $(UNIQUE_LIBS)                                          \
 
81
        $(EMPATHY_LIBS)                                         \
 
82
        $(GTK_LIBS)                                             \
 
83
@@ -147,6 +149,7 @@
 
84
         $(UNIQUE_LIBS)                                         \
 
85
         $(EMPATHY_LIBS)                                                        \
 
86
        $(INDICATE_LIBS)                                                \
 
87
+       $(UNITY_LIBS)                                                   \
 
88
         $(LIBCHAMPLAIN_LIBS)                                           \
 
89
         $(WEBKIT_LIBS)                                                 \
 
90
        $(NULL)
 
91
 
 
92
=== modified file 'src/empathy-chat-window.c'
 
93
--- old/src/empathy-chat-window.c       2011-02-15 17:12:08 +0000
 
94
+++ new/src/empathy-chat-window.c       2011-02-15 19:58:49 +0000
 
95
@@ -71,6 +71,10 @@
 
96
 #define DEBUG_FLAG EMPATHY_DEBUG_CHAT
 
97
 #include <libempathy/empathy-debug.h>
 
98
 
 
99
+#ifdef HAVE_UNITY
 
100
+#include <unity.h>
 
101
+#endif
 
102
+
 
103
 /* Macro to compare guint32 X timestamps, while accounting for wrapping around
 
104
  */
 
105
 #define X_EARLIER_OR_EQL(t1, t2) \
 
106
@@ -96,6 +100,9 @@
 
107
        /* EmpathyChat -> EmpathyIndicator for that chat, if any */
 
108
        GHashTable  *indicators;
 
109
 #endif
 
110
+#ifdef HAVE_UNITY
 
111
+       UnityLauncherEntry *launcher;
 
112
+#endif
 
113
        GtkTargetList *contact_targets;
 
114
        GtkTargetList *file_targets;
 
115
 
 
116
@@ -1304,8 +1311,19 @@
 
117
                        sender, body);
 
118
                g_signal_connect (indicator, "activate",
 
119
                                  G_CALLBACK (chat_window_indicator_activate_cb), chat);
 
120
-
 
121
                g_hash_table_insert (priv->indicators, chat, indicator);
 
122
+#ifdef HAVE_UNITY
 
123
+               if (priv->launcher != NULL)
 
124
+               {
 
125
+                       gint count = g_hash_table_size (priv->indicators);
 
126
+                       DEBUG ("unity launcher: count is now %d", count);
 
127
+                       if (count > 0)
 
128
+                       {
 
129
+                               unity_launcher_entry_set_count (priv->launcher, count);
 
130
+                               unity_launcher_entry_set_count_visible (priv->launcher, TRUE);
 
131
+                       }
 
132
+               }
 
133
+#endif
 
134
        }
 
135
        empathy_indicator_show (indicator);
 
136
 }
 
137
@@ -1322,6 +1340,25 @@
 
138
                DEBUG ("indicator is %p", indicator);
 
139
                empathy_indicator_hide (indicator);
 
140
                g_hash_table_remove (priv->indicators, chat);
 
141
+#ifdef HAVE_UNITY
 
142
+        if (priv->launcher != NULL)
 
143
+        {
 
144
+               gint count = g_hash_table_size (priv->indicators);
 
145
+               DEBUG ("unity launcher: count is %d", count);
 
146
+               if (count > 0)
 
147
+               {
 
148
+                       DEBUG ("unity launcher: setting count to %d", count);
 
149
+                       unity_launcher_entry_set_count (priv->launcher, count);
 
150
+                       unity_launcher_entry_set_count_visible (priv->launcher, TRUE);
 
151
+               } else {
 
152
+                       unity_launcher_entry_set_count (priv->launcher, count);
 
153
+                       DEBUG ("unity launcher: hiding count");
 
154
+                       unity_launcher_entry_set_count_visible (priv->launcher, FALSE);
 
155
+               }
 
156
+       }
 
157
+#endif
 
158
+
 
159
+
 
160
        } else {
 
161
                DEBUG ("indicator is NULL, nothing to remove");
 
162
        }
 
163
@@ -1955,6 +1992,11 @@
 
164
                priv->chat_manager = NULL;
 
165
        }
 
166
 
 
167
+       if (priv->launcher) {
 
168
+               g_object_unref (priv->launcher);
 
169
+               priv->launcher = NULL;
 
170
+       }
 
171
+
 
172
        chat_windows = g_list_remove (chat_windows, window);
 
173
        gtk_widget_destroy (priv->dialog);
 
174
 
 
175
@@ -2053,6 +2095,9 @@
 
176
        priv->indicators = g_hash_table_new_full (g_direct_hash, g_direct_equal,
 
177
                              NULL, g_object_unref);
 
178
 #endif
 
179
+#ifdef HAVE_UNITY
 
180
+       priv->launcher = unity_launcher_entry_get_for_desktop_id ("empathy.desktop");
 
181
+#endif
 
182
 
 
183
        priv->notebook = gtk_notebook_new ();
 
184
        gtk_notebook_set_group (GTK_NOTEBOOK (priv->notebook), "EmpathyChatWindow");
 
185
 
 
186
=== modified file 'src/empathy-indicator-manager.c'
 
187
--- old/src/empathy-indicator-manager.c 2011-02-15 17:12:52 +0000
 
188
+++ new/src/empathy-indicator-manager.c 2011-02-15 19:58:35 +0000
 
189
@@ -45,6 +45,10 @@
 
190
 #define DEBUG_FLAG EMPATHY_DEBUG_OTHER
 
191
 #include <libempathy/empathy-debug.h>
 
192
 
 
193
+#ifdef HAVE_UNITY
 
194
+#include <unity.h>
 
195
+#endif
 
196
+
 
197
 #define INDICATOR_LOGIN_TIMEOUT 15
 
198
 #define EMPATHY_DESKTOP_PATH DESKTOPDIR "/empathy.desktop"
 
199
 
 
200
@@ -62,6 +66,9 @@
 
201
   IndicateServer      *indicate_server;
 
202
   GSList              *indicator_events;
 
203
   GHashTable          *login_timeouts;
 
204
+#ifdef HAVE_UNITY
 
205
+  UnityLauncherEntry  *launcher;
 
206
+#endif
 
207
 } EmpathyIndicatorManagerPriv;
 
208
 
 
209
 typedef struct {
 
210
@@ -172,6 +179,20 @@
 
211
   g_object_unref (indicator);
 
212
   priv->indicator_events = g_slist_prepend (priv->indicator_events,
 
213
       indicator_event);
 
214
+#ifdef HAVE_UNITY
 
215
+  if (priv->launcher == NULL)
 
216
+  {
 
217
+          return;
 
218
+  }
 
219
+  gint count = g_slist_length (priv->indicator_events);
 
220
+  DEBUG ("unity launcher: count is %d", count);
 
221
+  if (count > 0)
 
222
+  {
 
223
+          unity_launcher_entry_set_count (priv->launcher, count);
 
224
+          unity_launcher_entry_set_count_visible (priv->launcher, TRUE);
 
225
+  }
 
226
+#endif
 
227
+
 
228
 }
 
229
 
 
230
 static void
 
231
@@ -195,6 +216,26 @@
 
232
       priv->indicator_events = g_slist_remove (priv->indicator_events,
 
233
           indicator_event);
 
234
       empathy_indicator_hide (indicator_event->indicator);
 
235
+#ifdef HAVE_UNITY
 
236
+        if (priv->launcher == NULL)
 
237
+        {
 
238
+                DEBUG ("unity launcher: launcher is NULL");
 
239
+                return;
 
240
+        }
 
241
+
 
242
+        gint count = g_slist_length (priv->indicator_events);
 
243
+        DEBUG ("unity launcher: count is %d", count);
 
244
+        if (count > 0)
 
245
+        {
 
246
+                DEBUG ("unity launcher: setting count to %d", count);
 
247
+                unity_launcher_entry_set_count (priv->launcher, count);
 
248
+                unity_launcher_entry_set_count_visible (priv->launcher, TRUE);
 
249
+        } else {
 
250
+                unity_launcher_entry_set_count (priv->launcher, count);
 
251
+                DEBUG ("unity launcher: hiding count");
 
252
+                unity_launcher_entry_set_count_visible (priv->launcher, FALSE);
 
253
+        }
 
254
+#endif
 
255
       return;
 
256
     }
 
257
   }
 
258
@@ -211,6 +252,8 @@
 
259
 
 
260
   priv = GET_PRIV (manager);
 
261
 
 
262
+  DEBUG ("Event updated");
 
263
+
 
264
   for (l = priv->indicator_events; l; l = l->next)
 
265
   {
 
266
     IndicatorEvent *indicator_event;
 
267
@@ -305,6 +348,10 @@
 
268
     g_object_unref (priv->indicate_server);
 
269
     priv->indicate_server = NULL;
 
270
   }
 
271
+  if (priv->launcher) {
 
272
+    g_object_unref (priv->launcher);
 
273
+    priv->launcher = NULL;
 
274
+  }
 
275
   if (priv->login_timeouts) {
 
276
     g_hash_table_unref (priv->login_timeouts);
 
277
     priv->login_timeouts = NULL;
 
278
@@ -379,6 +426,10 @@
 
279
       G_CALLBACK (indicate_server_activate),
 
280
       manager);
 
281
 
 
282
+#ifdef HAVE_UNITY
 
283
+  priv->launcher = unity_launcher_entry_get_for_desktop_id ("empathy.desktop");
 
284
+#endif
 
285
+
 
286
   g_signal_connect (priv->event_manager, "event-added",
 
287
       G_CALLBACK (indicator_manager_event_added_cb),
 
288
       manager);
 
289