static void
on_recover_clicked (GtkButton * button, gpointer user_data)
{
  BtCrashRecoverDialog *self = BT_CRASH_RECOVER_DIALOG (user_data);
  gchar *log_name = get_selected (self);
  gboolean res = FALSE;
  BtMainWindow *main_window;

  if (log_name) {
    BtChangeLog *change_log = bt_change_log_new ();

    GST_INFO ("recovering: %s", log_name);
    if (bt_change_log_recover (change_log, log_name)) {
      remove_selected (self);
      res = TRUE;
    }
    g_free (log_name);
    g_object_try_unref (change_log);
  }
  g_object_get (self->priv->app, "main-window", &main_window, NULL);
  /* close the recovery dialog */
  gtk_dialog_response (GTK_DIALOG (self), GTK_RESPONSE_CLOSE);
  if (res) {
    /* the song recovery has been finished */
    bt_dialog_message (main_window, _("Recovery finished"),
        _("The selected song has been recovered successful."),
        _("Please check the song and save it if everything is alright.")
        );
  } else {
    /* FIXME(ensonic): the log is still there
     * - this dialog should be a warning
     * - ev. we want to suggest to ask for support
     */
    /* one or more steps in the recovery did not apply */
    bt_dialog_message (main_window, _("Recovery failed"),
        _("Sorry, the selected song could not be fully recovered."),
        _("Please check the song and save it if still looks good.")
        );
  }
  g_object_unref (main_window);
}
Beispiel #2
0
static gboolean
bt_edit_application_run_ui_idle (gpointer user_data)
{
  BtEditApplication *self = BT_EDIT_APPLICATION (user_data);
  BtSettings *settings;
  guint version;
  gboolean res, show_tips;

  g_assert (self->priv->main_window);

  GST_INFO ("application.run_ui launched");

  g_object_get ((gpointer) self, "settings", &settings, NULL);
  g_object_get (settings, "news-seen", &version, "show-tips", &show_tips, NULL);

  if (PACKAGE_VERSION_NUMBER > version) {
    // show about
    bt_edit_application_show_about (self);
    // store new version
    version = PACKAGE_VERSION_NUMBER;
    g_object_set (settings, "news-seen", version, NULL);
  } else if (show_tips) {
    // show tip-of-the-day
    bt_edit_application_show_tip (self);
  }
  g_object_unref (settings);

  // check for missing elements
  if (!(res = bt_edit_application_check_missing (self)))
    gtk_main_quit ();

  // show error from a song we loaded
  if (self->priv->init_err && self->priv->init_file_name) {
    gchar *msg = g_strdup_printf (_("Can't load song '%s'."),
        self->priv->init_file_name);
    bt_dialog_message (self->priv->main_window, _("Can't load song"), msg,
        self->priv->init_err->message);
    g_free (msg);
    g_free (self->priv->init_file_name);
    g_error_free (self->priv->init_err);
  }
  // check for recoverable songs
  bt_edit_application_crash_log_recover (self);

  return FALSE;
}