[beast: 2/8] BST: remove calls to Janitor procedures



commit 577e212cefd220ab2289278a8a7f534d20169119
Author: Tim Janik <timj gnu org>
Date:   Sun Oct 1 01:26:39 2017 +0200

    BST: remove calls to Janitor procedures
    
    Signed-off-by: Tim Janik <timj gnu org>

 beast-gtk/bstusermessage.cc |  129 ++-----------------------------------------
 1 files changed, 5 insertions(+), 124 deletions(-)
---
diff --git a/beast-gtk/bstusermessage.cc b/beast-gtk/bstusermessage.cc
index b0ca511..4a125c8 100644
--- a/beast-gtk/bstusermessage.cc
+++ b/beast-gtk/bstusermessage.cc
@@ -71,22 +71,9 @@ message_title (const BstMessage *msg,
   if (msg->title)
     return g_strconcat (message, ": ", msg->title, NULL);
   else
-    {
-      const gchar *proc_name = msg->janitor ? bse_janitor_get_proc_name (msg->janitor) : NULL;
-      const gchar *proc_title = bst_procedure_get_title (proc_name);
-      if (proc_title)
-        return g_strconcat (message, ": ", proc_title, NULL);
-      else
-        return g_strdup (message);
-    }
-}
-static void
-janitor_action (gpointer   data,
-               GtkWidget *widget)
-{
-  SfiProxy proxy = (SfiProxy) data;
-  bse_janitor_trigger_action (proxy, (const char*) g_object_get_data (G_OBJECT (widget), "user_data"));
+    return g_strdup (message);
 }
+
 static void
 toggle_update_filter (GtkWidget *toggle,
                       gpointer   data)
@@ -119,11 +106,8 @@ adapt_message_spacing (const gchar *head,
 static gchar*
 strdup_msg_hashkey (const BstMessage *msg)
 {
-  /* prefer hashing by janitor/process name over PID */
-  if (msg->janitor)
-    return g_strdup_format ("## %x ## %s ## %s ## J%s:%s", msg->type, msg->primary, msg->secondary,
-                            bse_janitor_get_script_name (msg->janitor), bse_janitor_get_proc_name 
(msg->janitor));
-  else if (msg->process)
+  /* prefer hashing by process name over PID */
+  if (msg->process)
     return g_strdup_format ("## %x ## %s ## %s ## P%s", msg->type, msg->primary, msg->secondary, 
msg->process);
   else
     return g_strdup_format ("## %x ## %s ## %s ## N%x", msg->type, msg->primary, msg->secondary, msg->pid);
@@ -205,17 +189,13 @@ bst_msg_dialog_update (GxkDialog        *dialog,
                         1, 2, row, row + 1, /* left/right, top/bottom */
                         GTK_FILL | GTK_EXPAND, GTK_FILL, 5, 5);
       row++;
-      const gchar *proc_name = !msg->janitor ? NULL : bse_janitor_get_proc_name (msg->janitor);
-      const gchar *script_name = proc_name ? bse_janitor_get_script_name (msg->janitor) : NULL;
       GString *gstring = g_string_new (msg->details);
       while (gstring->len && gstring->str[gstring->len - 1] == '\n')
         g_string_erase (gstring, gstring->len - 1, 1);
       g_string_add_format (gstring, "\n\n");
-      if (hastext (proc_name))
-        g_string_add_format (gstring, _("Procedure: %s\nScript: %s\n"), proc_name, script_name);
       if (hastext (msg->process))
         g_string_add_format (gstring, _("Process: %s\n"), msg->process);
-      if (hastext (msg->log_domain) && !hastext (proc_name) && !hastext (msg->process))
+      if (hastext (msg->log_domain) && !hastext (msg->process))
         g_string_add_format (gstring, _("Origin:  %s\n"), msg->log_domain);
       if (msg->pid && BST_DVL_HINTS)
           g_string_add_format (gstring, _("PID:     %u\n"), msg->pid);
@@ -264,33 +244,6 @@ bst_msg_dialog_update (GxkDialog        *dialog,
   g_free (title);
 }
 
-static void
-bst_msg_dialog_janitor_update (GxkDialog        *dialog,
-                               SfiProxy          janitor)
-{
-  assert_return (BSE_IS_JANITOR (janitor));
-
-  guint i, n = bse_janitor_n_actions (janitor);
-  for (i = 0; i < n; i++)
-    {
-      const gchar *action = bse_janitor_get_action (janitor, i);
-      const gchar *name = bse_janitor_get_action_name (janitor, i);
-      const gchar *blurb = bse_janitor_get_action_blurb (janitor, i);
-
-      if (action)
-        {
-          GtkWidget *button = gxk_dialog_action_multi (dialog, name,
-                                                       (void*) janitor_action, (gpointer) janitor,
-                                                       action, GXK_DIALOG_MULTI_SWAPPED);
-          g_object_set_data_full (G_OBJECT (button), "user_data", g_strdup (action), g_free);
-          gxk_widget_set_tooltip (button, blurb);
-        }
-    }
-  GtkWidget *bwidget = gxk_dialog_action (dialog, BST_STOCK_CANCEL, (void*) gxk_toplevel_delete, NULL);
-  gxk_dialog_set_focus (dialog, bwidget);
-}
-
-
 void
 bst_msg_bit_free (BstMsgBit *mbit)
 {
@@ -519,75 +472,10 @@ message_free_from_script (BstMessage *msg)
 }
 
 static void
-janitor_actions_changed (GxkDialog *dialog)
-{
-  SfiProxy janitor = (SfiProxy) g_object_get_data (G_OBJECT (dialog), "user-data");
-  BstMessage msg = { 0, };
-  const gchar *user_msg = NULL;
-  bse_proxy_get (janitor, "status-message", &user_msg, NULL);
-  const gchar *proc_name = bse_janitor_get_proc_name (janitor);
-  const gchar *script_name = bse_janitor_get_script_name (janitor);
-  message_fill_from_script (&msg, BST_MSG_SCRIPT, 0, NULL, script_name, proc_name, user_msg);
-  bst_msg_dialog_update (dialog, &msg, FALSE);
-  bst_msg_dialog_janitor_update (dialog, janitor);
-  message_free_from_script (&msg);
-}
-
-static void
-janitor_progress (GxkDialog *dialog,
-                 SfiReal    progress)
-{
-  SfiProxy janitor = (SfiProxy) g_object_get_data (G_OBJECT (dialog), "user-data");
-  const gchar *script = bse_janitor_get_script_name (janitor);
-  const gchar *sbname = strrchr (script, '/');
-  gchar *exec_name = g_strdup_format ("%s", sbname ? sbname + 1 : script);
-  // bse_janitor_get_proc_name (janitor);
-  gxk_status_window_push (dialog);
-  if (progress < 0)
-    gxk_status_set (GXK_STATUS_PROGRESS, exec_name, _("processing"));
-  else
-    gxk_status_set (progress * 100.0, exec_name, _("processing"));
-  gxk_status_window_pop ();
-  g_free (exec_name);
-}
-
-static void
-janitor_unconnected (GxkDialog *dialog)
-{
-  SfiProxy janitor = (SfiProxy) g_object_get_data (G_OBJECT (dialog), "user-data");
-  gboolean connected = FALSE;
-  const gchar *exit_reason = NULL;
-  gint exit_code;
-  bse_proxy_get (janitor, "connected", &connected, "exit-code", &exit_code, "exit-reason", &exit_reason, 
NULL);
-  if (!connected)
-    {
-      const gchar *proc_name = bse_janitor_get_proc_name (janitor);
-      const gchar *script_name = bse_janitor_get_script_name (janitor);
-      /* destroy script dialog *and* janitor reference */
-      gtk_widget_destroy (GTK_WIDGET (dialog));
-      /* notify user about unsuccessful exits */
-      if (exit_reason)
-        {
-          BstMessage msg = { 0, };
-          gchar *error_msg = g_strdup_format (_("An error occoured during execution of script procedure 
'%s': %s"), proc_name, exit_reason);
-          message_fill_from_script (&msg, BST_MSG_ERROR, 0, _("Script execution error."), script_name, 
proc_name, error_msg);
-          g_free (error_msg);
-          bst_message_handler (&msg);
-          message_free_from_script (&msg);
-        }
-    }
-}
-
-static void
 janitor_window_deleted (GxkDialog *dialog)
 {
   SfiProxy janitor = (SfiProxy) g_object_get_data (G_OBJECT (dialog), "user-data");
 
-  bse_proxy_disconnect (janitor,
-                       "any_signal", janitor_actions_changed, dialog,
-                       "any_signal", janitor_progress, dialog,
-                       "any_signal", janitor_unconnected, dialog,
-                       NULL);
   // bse_janitor_kill (janitor);
   Bse::ItemH::down_cast (bse_server.from_proxy (janitor)).unuse();
 }
@@ -601,13 +489,6 @@ create_janitor_dialog (SfiProxy janitor)
   gxk_dialog_set_sizes (dialog, -1, -1, 512, -1);
 
   g_object_set_data (G_OBJECT (dialog), "user-data", (gpointer) janitor);
-  bse_proxy_connect (janitor,
-                    "swapped-object-signal::action-changed", janitor_actions_changed, dialog,
-                    "swapped-object-signal::property-notify::user-msg", janitor_actions_changed, dialog,
-                    "swapped-object-signal::progress", janitor_progress, dialog,
-                    "swapped-object-signal::property-notify::connected", janitor_unconnected, dialog,
-                    NULL);
-  janitor_actions_changed (dialog);
   Bse::ItemH::down_cast (bse_server.from_proxy (janitor)).use();
   g_object_connect (dialog, "swapped_signal::destroy", janitor_window_deleted, dialog, NULL);
   dialog_show_above_modals (dialog, FALSE);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]