~3v1n0/bamf/bamf-desktop-file-atom

« back to all changes in this revision

Viewing changes to src/bamf-matcher.c

  • Committer: Lars Uebernickel
  • Author(s): Marco Trevisan
  • Date: 2015-02-02 09:56:55 UTC
  • Revision ID: lars.uebernickel@canonical.com-20150202095655-zkguv3r7xcwsncfg
matcher: look for app ids only if desktop_file is not set

Show diffs side-by-side

added added

removed removed

Lines of Context:
1617
1617
  BamfMatcherPrivate *priv;
1618
1618
  BamfLegacyWindow *window;
1619
1619
  GList *desktop_files = NULL, *l;
1620
 
  gchar *app_id;
 
1620
  char *app_id;
1621
1621
  char *desktop_file = NULL;
1622
1622
  const char *desktop_class = NULL;
1623
1623
  const char *class_name = NULL;
1630
1630
 
1631
1631
  priv = self->priv;
1632
1632
  window = bamf_window_get_window (bamf_window);
1633
 
  app_id = bamf_legacy_window_get_hint (window, _GTK_APPLICATION_ID);
1634
1633
  desktop_file = bamf_legacy_window_get_hint (window, _NET_WM_DESKTOP_FILE);
1635
1634
  class_name = bamf_legacy_window_get_class_name (window);
1636
1635
  instance_name = bamf_legacy_window_get_class_instance_name (window);
1658
1657
        }
1659
1658
    }
1660
1659
 
1661
 
  if (app_id)
1662
 
    {
1663
 
      GList *file_list;
1664
 
 
1665
 
      if ((file_list = g_hash_table_lookup (priv->desktop_id_table, app_id)))
1666
 
        desktop_files = g_list_prepend (desktop_files, g_strdup (file_list->data));
1667
 
 
1668
 
      g_free (app_id);
1669
 
    }
1670
 
 
1671
1660
  if (desktop_file)
1672
1661
    {
1673
1662
      desktop_class = bamf_matcher_get_desktop_file_class (self, desktop_file);
1690
1679
        {
1691
1680
          desktop_files = g_list_prepend (desktop_files, desktop_file);
1692
1681
        }
 
1682
      else
 
1683
        {
 
1684
          app_id = bamf_legacy_window_get_hint (window, _GTK_APPLICATION_ID);
 
1685
 
 
1686
          if (app_id)
 
1687
            {
 
1688
              for (l = g_hash_table_lookup (priv->desktop_id_table, app_id); l; l = l->next)
 
1689
                {
 
1690
                  desktop_file = l->data;
 
1691
                  desktop_class = bamf_matcher_get_desktop_file_class (self, desktop_file);
 
1692
 
 
1693
                  if ((!filter_by_wmclass && !desktop_class) || g_strcmp0 (desktop_class, target_class) == 0)
 
1694
                    {
 
1695
                      desktop_files = g_list_prepend (desktop_files, g_strdup (desktop_file));
 
1696
                    }
 
1697
                }
 
1698
 
 
1699
              g_free (app_id);
 
1700
            }
 
1701
        }
1693
1702
    }
1694
1703
 
1695
1704
  desktop_file = NULL;