341
get_open_office_window_hint (BamfMatcher * self, BamfLegacyWindow * window)
341
get_libreoffice_window_hint (BamfMatcher * self, BamfLegacyWindow * window)
343
343
gchar *exec = NULL;
345
344
const gchar *class;
346
345
const char *binary = NULL;
347
346
const char *parameter = NULL;
350
349
g_return_val_if_fail (BAMF_IS_MATCHER (self), NULL);
351
350
g_return_val_if_fail (BAMF_IS_LEGACY_WINDOW (window), NULL);
353
name = bamf_legacy_window_get_name (window);
354
352
class = bamf_legacy_window_get_class_name (window);
355
type = bamf_legacy_window_get_window_type (window);
357
if (name == NULL && class == NULL)
360
if (g_str_has_suffix (name, "LibreOffice Writer"))
362
binary = "libreoffice";
363
parameter = "writer";
365
else if (g_str_has_suffix (name, "LibreOffice Calc"))
367
binary = "libreoffice";
370
else if (g_str_has_suffix (name, "LibreOffice Impress"))
372
binary = "libreoffice";
373
parameter = "impress";
375
else if (g_str_has_suffix (name, "LibreOffice Math"))
377
binary = "libreoffice";
380
else if (g_str_has_suffix (name, "LibreOffice Draw"))
382
binary = "libreoffice";
385
else if (g_str_has_suffix (name, "LibreOffice Base"))
387
binary = "libreoffice";
390
else if (g_strcmp0 (class, "libreoffice-startcenter") == 0)
392
binary = "libreoffice";
394
else if (g_strcmp0 (name, "LibreOffice") == 0 && type == BAMF_WINDOW_NORMAL)
396
binary = "libreoffice";
398
else if (g_str_has_suffix (name, "OpenOffice.org Writer"))
401
parameter = "writer";
403
else if (g_str_has_suffix (name, "OpenOffice.org Calc"))
408
else if (g_str_has_suffix (name, "OpenOffice.org Impress"))
411
parameter = "impress";
413
else if (g_str_has_suffix (name, "OpenOffice.org Math"))
418
else if (g_str_has_suffix (name, "OpenOffice.org Draw"))
423
else if (g_str_has_suffix (name, "OpenOffice.org Base"))
428
else if (g_strcmp0 (name, "OpenOffice.org") == 0 && type == BAMF_WINDOW_NORMAL)
434
if (type != BAMF_WINDOW_NORMAL || bamf_legacy_window_get_transient (window))
436
/* Child windows can generally easily be recognized by their class */
437
if (g_strcmp0 (class, "libreoffice-writer") == 0)
439
binary = "libreoffice";
440
parameter = "writer";
442
else if (g_strcmp0 (class, "libreoffice-calc") == 0)
444
binary = "libreoffice";
447
else if (g_strcmp0 (class, "libreoffice-impress") == 0)
449
binary = "libreoffice";
450
parameter = "impress";
452
else if (g_strcmp0 (class, "libreoffice-math") == 0)
454
binary = "libreoffice";
457
else if (g_strcmp0 (class, "libreoffice-draw") == 0)
459
binary = "libreoffice";
462
else if (g_strcmp0 (class, "libreoffice-base") == 0)
464
binary = "libreoffice";
471
/* By default fallback to the main launcher */
472
if (g_str_has_prefix (class, "OpenOffice"))
478
binary = "libreoffice";
490
exec = g_strconcat (binary, " --", parameter, NULL);
491
l = g_hash_table_lookup (self->priv->desktop_file_table, exec);
496
exec = g_strconcat (binary, " -", parameter, NULL);
497
l = g_hash_table_lookup (self->priv->desktop_file_table, exec);
502
exec = g_strconcat (binary, "-", parameter, NULL);
503
l = g_hash_table_lookup (self->priv->desktop_id_table, exec);
510
l = g_hash_table_lookup (self->priv->desktop_file_table, binary);
357
if (g_str_has_prefix (class, "libreoffice-"))
359
l = g_hash_table_lookup (self->priv->desktop_id_table, class);
364
binary = "libreoffice";
366
parameter = strchr(class, '-');
370
parameter = parameter + 1;
372
exec = g_strconcat (binary, " --", parameter, NULL);
373
l = g_hash_table_lookup (self->priv->desktop_file_table, exec);
378
exec = g_strconcat (binary, " -", parameter, NULL);
379
l = g_hash_table_lookup (self->priv->desktop_file_table, exec);
384
exec = g_strconcat (binary, "-", parameter, NULL);
385
l = g_hash_table_lookup (self->priv->desktop_id_table, exec);
392
l = g_hash_table_lookup (self->priv->desktop_file_table, binary);
513
396
return (l ? (char *) l->data : NULL);
2154
on_open_office_window_closed (BamfLegacyWindow *window, BamfMatcher* self)
2037
on_libreoffice_window_closed (BamfLegacyWindow *window, BamfMatcher* self)
2156
g_signal_handlers_disconnect_by_func (window, on_open_office_window_name_changed, self);
2039
g_signal_handlers_disconnect_by_func (window, on_libreoffice_window_class_changed, self);
2157
2040
g_object_unref (window);
2161
2044
get_gnome_control_center_window_hint (BamfMatcher * self, BamfLegacyWindow * window)
2166
2049
g_return_val_if_fail (BAMF_IS_MATCHER (self), NULL);
2167
2050
g_return_val_if_fail (BAMF_IS_LEGACY_WINDOW (window), NULL);
2169
role = bamf_legacy_window_get_hint (window, WM_WINDOW_ROLE);
2052
role = bamf_legacy_window_get_role (window);
2173
2056
gchar *exec = g_strconcat ("gnome-control-center ", role, NULL);
2174
2057
list = g_hash_table_lookup (self->priv->desktop_file_table, exec);
2179
2061
if (!role || !list)