~ubuntu-branches/debian/experimental/xfce4-panel/experimental

« back to all changes in this revision

Viewing changes to panel/panel-plugin-external.c

  • Committer: Bazaar Package Importer
  • Author(s): Yves-Alexis Perez
  • Date: 2011-02-27 00:55:05 UTC
  • mfrom: (1.3.14 upstream)
  • Revision ID: james.westby@ubuntu.com-20110227005505-qjs77aald09qzy26
Tags: 4.8.2-1
New upstream bugfix release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
static gboolean     panel_plugin_external_plug_removed            (GtkSocket                        *socket);
69
69
static gboolean     panel_plugin_external_child_ask_restart       (PanelPluginExternal              *external);
70
70
static void         panel_plugin_external_child_spawn             (PanelPluginExternal              *external);
71
 
static gboolean     panel_plugin_external_child_respawn           (gpointer                          user_data);
72
 
static void         panel_plugin_external_child_respawn_destroyed (gpointer                          user_data);
 
71
static void         panel_plugin_external_child_respawn_schedule  (PanelPluginExternal              *external);
73
72
static void         panel_plugin_external_child_watch             (GPid                              pid,
74
73
                                                                   gint                              status,
75
74
                                                                   gpointer                          user_data);
340
339
 
341
340
      panel_plugin_external_child_spawn (external);
342
341
    }
 
342
  else
 
343
    {
 
344
      /* the child was asked to quit during unrealize and there is
 
345
       * still an pid, so wait for the child to quit and then
 
346
       * spawn it again */
 
347
      panel_plugin_external_child_respawn_schedule (external);
 
348
    }
343
349
}
344
350
 
345
351
 
619
625
    return FALSE;
620
626
 
621
627
  /* delay startup if the old child is still embedded */
622
 
  if (external->priv->embedded)
 
628
  if (external->priv->embedded
 
629
      || external->priv->pid != 0)
623
630
    {
624
631
      panel_debug (PANEL_DEBUG_EXTERNAL,
625
632
                   "%s-%d: still a child embedded, respawn delayed",
651
658
 
652
659
 
653
660
static void
 
661
panel_plugin_external_child_respawn_schedule (PanelPluginExternal *external)
 
662
{
 
663
  panel_return_if_fail (PANEL_IS_PLUGIN_EXTERNAL (external));
 
664
 
 
665
  if (external->priv->spawn_timeout_id == 0)
 
666
    {
 
667
      panel_debug (PANEL_DEBUG_EXTERNAL,
 
668
                   "%s-%d: scheduled a respawn of the child",
 
669
                   panel_module_get_name (external->module), external->unique_id);
 
670
 
 
671
      /* schedule a restart timeout */
 
672
      external->priv->spawn_timeout_id = g_timeout_add_full (G_PRIORITY_LOW, 100, panel_plugin_external_child_respawn,
 
673
                                                             external, panel_plugin_external_child_respawn_destroyed);
 
674
    }
 
675
}
 
676
 
 
677
 
 
678
 
 
679
static void
654
680
panel_plugin_external_child_watch (GPid     pid,
655
681
                                   gint     status,
656
682
                                   gpointer user_data)
661
687
  panel_return_if_fail (PANEL_IS_PLUGIN_EXTERNAL (external));
662
688
  panel_return_if_fail (external->priv->pid == pid);
663
689
 
 
690
  /* reset the pid, it can't be embedded as well */
664
691
  external->priv->pid = 0;
 
692
  external->priv->embedded = FALSE;
665
693
 
666
694
  panel_debug (PANEL_DEBUG_EXTERNAL,
667
695
               "%s-%d: child exited with status %d",
715
743
    }
716
744
 
717
745
  if (GTK_WIDGET_REALIZED (external)
718
 
      && external->priv->spawn_timeout_id == 0
719
746
      && (auto_restart || panel_plugin_external_child_ask_restart (external)))
720
747
    {
721
 
       panel_debug (PANEL_DEBUG_EXTERNAL,
722
 
                    "%s-%d: scheduled a respawn of the child",
723
 
                    panel_module_get_name (external->module), external->unique_id);
724
 
 
725
 
       /* schedule a restart timeout */
726
 
       external->priv->spawn_timeout_id = g_timeout_add_full (G_PRIORITY_LOW, 100, panel_plugin_external_child_respawn,
727
 
                                                              external, panel_plugin_external_child_respawn_destroyed);
 
748
      panel_plugin_external_child_respawn_schedule (external);
728
749
    }
729
750
 
730
751
close_pid: