~timo-jyrinki/bamf/ubuntu-0.2.124.1

« back to all changes in this revision

Viewing changes to src/bamf-application.c

  • Committer: Sebastien Bacher
  • Date: 2012-05-24 10:45:29 UTC
  • mfrom: (416.1.1 ubuntu)
  • Revision ID: seb128@ubuntu.com-20120524104529-0qdsxch9ovw2r5vk
[ Didier Roche ]
* New upstream release. (0.2.116)
[ Alan Pope ]
* New upstream release.
  - Unity crashed in bamf_application_on_window_removed (LP: #1000577)
  - Locked smuxi launcher icon does not indicate smuxi running status
    (LP: #999820)
  - No launcher icon or Alt+Tab entry for Gimp windows (LP: #995916)
  - the RunningApplicationsChanged signal is no longer emitted when an 
    application is closed since r460 (LP: #989551)

Show diffs side-by-side

added added

removed removed

Lines of Context:
120
120
  if (self->priv->desktop_file)
121
121
    {
122
122
      keyfile = g_key_file_new();
123
 
      if (!g_key_file_load_from_file(keyfile, self->priv->desktop_file, G_KEY_FILE_NONE, NULL)) {
 
123
 
 
124
      if (!g_key_file_load_from_file(keyfile, self->priv->desktop_file, G_KEY_FILE_NONE, NULL))
 
125
        {
124
126
          g_key_file_free(keyfile);
125
 
        return;
126
 
      }
 
127
          return;
 
128
        }
127
129
 
128
130
      desktop = g_desktop_app_info_new_from_keyfile (keyfile);
129
131
 
130
 
      if (!G_IS_APP_INFO (desktop)) {
131
 
        g_key_file_free(keyfile);
132
 
        return;
133
 
      }
 
132
      if (!G_IS_APP_INFO (desktop))
 
133
        {
 
134
          g_key_file_free(keyfile);
 
135
          return;
 
136
        }
134
137
 
135
138
      gicon = g_app_info_get_icon (G_APP_INFO (desktop));
136
139
 
139
142
      if (gicon)
140
143
        icon = g_icon_to_string (gicon);
141
144
 
142
 
      if (g_key_file_has_key(keyfile, G_KEY_FILE_DESKTOP_GROUP, STUB_KEY, NULL)) {
143
 
        /* This will error to return false, which is okay as it seems
144
 
           unlikely anyone will want to set this flag except to turn
145
 
           off the stub menus. */
146
 
        self->priv->show_stubs = g_key_file_get_boolean (keyfile,
147
 
                                                         G_KEY_FILE_DESKTOP_GROUP,
148
 
                                                         STUB_KEY, NULL);
149
 
      }
 
145
      if (g_key_file_has_key(keyfile, G_KEY_FILE_DESKTOP_GROUP, STUB_KEY, NULL))
 
146
        {
 
147
          /* This will error to return false, which is okay as it seems
 
148
             unlikely anyone will want to set this flag except to turn
 
149
             off the stub menus. */
 
150
          self->priv->show_stubs = g_key_file_get_boolean (keyfile,
 
151
                                                           G_KEY_FILE_DESKTOP_GROUP,
 
152
                                                           STUB_KEY, NULL);
 
153
        }
150
154
      
151
155
      if (g_key_file_has_key (keyfile, G_KEY_FILE_DESKTOP_GROUP, "X-GNOME-FullName", NULL))
152
156
        {
300
304
 
301
305
gboolean
302
306
bamf_application_contains_similar_to_window (BamfApplication *self,
303
 
                                             BamfWindow *window)
 
307
                                             BamfWindow *bamf_window)
304
308
{
305
 
  gboolean result = FALSE;
306
 
  const char *class, *owned_class;
307
309
  GList *children, *l;
308
310
  BamfView *child;
309
311
 
310
312
  g_return_val_if_fail (BAMF_IS_APPLICATION (self), FALSE);
311
 
  g_return_val_if_fail (BAMF_IS_WINDOW (window), FALSE);
312
 
 
313
 
  class = bamf_legacy_window_get_class_name (bamf_window_get_window (window));
 
313
  g_return_val_if_fail (BAMF_IS_WINDOW (bamf_window), FALSE);
 
314
 
 
315
  BamfLegacyWindow *window = bamf_window_get_window (bamf_window);
 
316
  const char *window_class = bamf_legacy_window_get_class_name (window);
 
317
  const char *instance_name = bamf_legacy_window_get_class_instance_name (window);
 
318
 
 
319
  if (!window_class || !instance_name)
 
320
    return FALSE;
314
321
 
315
322
  children = bamf_view_get_children (BAMF_VIEW (self));
316
323
  for (l = children; l; l = l->next)
320
327
      if (!BAMF_IS_WINDOW (child))
321
328
        continue;
322
329
 
323
 
      owned_class = bamf_legacy_window_get_class_name (bamf_window_get_window (BAMF_WINDOW (child)));
 
330
      window = bamf_window_get_window (BAMF_WINDOW (child));
 
331
      const char *owned_win_class = bamf_legacy_window_get_class_name (window);
 
332
      const char *owned_instance = bamf_legacy_window_get_class_instance_name (window);
324
333
 
325
 
      if (g_strcmp0 (class, owned_class) == 0)
 
334
      if (g_strcmp0 (window_class, owned_win_class) == 0 &&
 
335
          g_strcmp0 (instance_name, owned_instance) == 0)
326
336
        {
327
 
          result = TRUE;
328
 
          break;
 
337
          return TRUE;
329
338
        }
330
339
    }
331
340
 
332
 
  return result;
 
341
  return FALSE;
333
342
}
334
343
 
335
344
gboolean
484
493
}
485
494
 
486
495
static char *
487
 
bamf_application_favorite_from_list (BamfApplication *self, GList *list)
 
496
bamf_application_favorite_from_list (BamfApplication *self, GList *desktop_list)
488
497
{
489
498
  BamfMatcher *matcher;
490
499
  GList *favs, *l;
491
500
  char *result = NULL;
 
501
  const char *desktop_class;
492
502
 
493
503
  g_return_val_if_fail (BAMF_IS_APPLICATION (self), NULL);
494
504
 
499
509
    {
500
510
      for (l = favs; l; l = l->next)
501
511
        {
502
 
          if (g_list_find_custom (list, l->data, (GCompareFunc) g_strcmp0))
 
512
          if (g_list_find_custom (desktop_list, l->data, (GCompareFunc) g_strcmp0))
503
513
            {
504
 
              result = l->data;
505
 
              break;
 
514
              desktop_class = bamf_matcher_get_desktop_file_class (matcher, l->data);
 
515
 
 
516
              if (!desktop_class || g_strcmp0 (self->priv->wmclass, desktop_class) == 0)
 
517
                {
 
518
                  result = l->data;
 
519
                  break;
 
520
                }
506
521
            }
507
522
        }
508
523
    }