~3v1n0/bamf/libbamf-safer-factory-rematch

« back to all changes in this revision

Viewing changes to lib/libbamf/bamf-view.c

  • Committer: Tarmac
  • Author(s): Marco Trevisan (Treviño)
  • Date: 2012-06-22 10:25:17 UTC
  • mfrom: (467.3.3 bamf)
  • Revision ID: tarmac-20120622102517-xfdteimy9w16us2k
BamfMatcher: force a view as closed or not-closed on proper signals.
  
  This avoids that a view that is opened is actually marked as closed when
  really it's running. Fixes #925421. Fixes: https://bugs.launchpad.net/bugs/925421. Approved by Jason Smith.

Show diffs side-by-side

added added

removed removed

Lines of Context:
560
560
  view->priv->path = NULL;
561
561
}
562
562
 
 
563
void
 
564
_bamf_view_set_closed (BamfView *view, gboolean closed)
 
565
{
 
566
  BamfViewPrivate *priv;
 
567
  g_return_if_fail (BAMF_IS_VIEW (view));
 
568
 
 
569
  priv = view->priv;
 
570
 
 
571
  if (priv->is_closed != closed)
 
572
    {
 
573
      priv->is_closed = closed;
 
574
 
 
575
      if (closed && priv->cached_children)
 
576
        {
 
577
          g_list_free_full (priv->cached_children, g_object_unref);
 
578
          priv->cached_children = NULL;
 
579
        }
 
580
    }
 
581
}
 
582
 
563
583
static void
564
584
bamf_view_on_closed (DBusGProxy *proxy, BamfView *self)
565
585
{
566
 
  BamfViewPrivate *priv;
567
 
 
568
 
  priv = self->priv;
569
 
 
570
 
  priv->is_closed = TRUE;
571
 
 
572
 
  if (priv->cached_children)
573
 
    {
574
 
      g_list_free_full (priv->cached_children, g_object_unref);
575
 
      priv->cached_children = NULL;
576
 
    }
 
586
  _bamf_view_set_closed (self, TRUE);
577
587
 
578
588
  g_object_ref (self);
579
 
 
580
589
  g_signal_emit (G_OBJECT (self), view_signals[CLOSED], 0);
581
590
  g_object_unref (self);
582
591
}
772
781
  g_return_if_fail (path);
773
782
 
774
783
  priv = view->priv;
775
 
  priv->is_closed = FALSE;
 
784
 
 
785
  _bamf_view_set_closed (view, FALSE);
776
786
 
777
787
  if (priv->proxy && g_strcmp0 (priv->path, path) == 0)
778
788
    {
1017
1027
  GError *error = NULL;
1018
1028
 
1019
1029
  priv = self->priv = BAMF_VIEW_GET_PRIVATE (self);
1020
 
 
1021
 
  priv->is_closed = TRUE;
 
1030
  _bamf_view_set_closed (self, TRUE);
1022
1031
 
1023
1032
  priv->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
1024
1033
  if (priv->connection == NULL)