137
136
/**********************
139
138
**********************/
139
static gboolean indicator_appmenu_delayed_init (IndicatorAppmenu * iapp);
140
140
static void indicator_appmenu_dispose (GObject *object);
141
141
static void indicator_appmenu_finalize (GObject *object);
142
142
static void build_window_menus (IndicatorAppmenu * iapp);
265
/* Per instance Init */
267
indicator_appmenu_init (IndicatorAppmenu *self)
269
self->apps = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_object_unref);
270
self->mode = MODE_STANDARD;
271
self->active_stubs = STUBS_UNKNOWN;
273
/* Setup the cache of windows with possible desktop entries */
274
self->desktop_windows = g_hash_table_new(g_direct_hash, g_direct_equal);
276
g_idle_add((GSourceFunc) indicator_appmenu_delayed_init, self);
265
279
/* Delayed Init, this is done so it can happen after that the mode has been set */
267
281
indicator_appmenu_delayed_init (IndicatorAppmenu *self)
283
if (indicator_object_check_environment(INDICATOR_OBJECT(self), "unity-all-menus")) {
284
self->mode = MODE_UNITY_ALL_MENUS;
285
} else if (indicator_object_check_environment(INDICATOR_OBJECT(self), "unity")) {
286
self->mode = MODE_UNITY;
289
if (self->mode != MODE_STANDARD)
290
self->active_stubs = STUBS_HIDE;
269
292
if (self->active_stubs != STUBS_HIDE)
270
293
build_window_menus(self);
298
321
return G_SOURCE_REMOVE;
301
/* Per instance Init */
303
indicator_appmenu_init (IndicatorAppmenu *self)
305
self->apps = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_object_unref);
306
self->mode = MODE_UNSET;
307
self->active_stubs = STUBS_UNKNOWN;
309
/* Setup the cache of windows with possible desktop entries */
310
self->desktop_windows = g_hash_table_new(g_direct_hash, g_direct_equal);
312
g_idle_add((GSourceFunc) indicator_appmenu_delayed_init, self);
316
get_mode (IndicatorAppmenu * iapp)
318
if (iapp->mode != MODE_UNSET) {
322
if (indicator_object_check_environment(INDICATOR_OBJECT(iapp), "unity-all-menus")) {
323
iapp->mode = MODE_UNITY;
324
switch_default_app(iapp, NULL, NULL);
325
iapp->mode = MODE_UNITY_ALL_MENUS;
329
g_hash_table_iter_init(&iter, iapp->apps);
330
while (g_hash_table_iter_next (&iter, NULL, &value)) {
331
connect_to_menu_signals(iapp, WINDOW_MENU (value));
334
find_relevant_windows(iapp);
335
} else if (indicator_object_check_environment(INDICATOR_OBJECT(iapp), "unity")) {
336
iapp->mode = MODE_UNITY;
338
iapp->mode = MODE_STANDARD;
341
if (iapp->mode != MODE_STANDARD)
342
iapp->active_stubs = STUBS_HIDE;
348
325
on_bus_acquired (GDBusConnection * connection, const gchar * name,
349
326
gpointer user_data)
615
592
IndicatorAppmenu * iapp = INDICATOR_APPMENU(user_data);
616
593
guint32 xid = bamf_window_get_xid(window);
618
if (get_mode(iapp) == MODE_UNITY_ALL_MENUS) {
595
if (iapp->mode == MODE_UNITY_ALL_MENUS) {
619
596
ensure_menus(iapp, window);
713
690
GList* entries = NULL;
715
if (get_mode(iapp) == MODE_UNITY_ALL_MENUS) {
692
if (iapp->mode == MODE_UNITY_ALL_MENUS) {
716
693
g_hash_table_iter_init (&iter, iapp->apps);
717
694
while (g_hash_table_iter_next (&iter, NULL, &value)) {
718
695
GList *app_entries = window_menu_get_entries (WINDOW_MENU (value));
1037
1014
g_hash_table_insert(iapp->apps, GUINT_TO_POINTER(xid), menus);
1039
if (get_mode(iapp) == MODE_UNITY_ALL_MENUS) {
1016
if (iapp->mode == MODE_UNITY_ALL_MENUS) {
1040
1017
connect_to_menu_signals(iapp, menus);