static gboolean debug_log_io_cb (GIOChannel *io, GIOCondition condition, gpointer data)
{
    char a;

    while (read (debug_log_pipes[0], &a, 1) != 1)
        ;

    caja_debug_log (TRUE, CAJA_DEBUG_LOG_DOMAIN_USER,
                    "user requested dump of debug log");

    dump_debug_log ();
    return FALSE;
}
Exemple #2
0
void
fm_rename_file (CajaFile *file,
                const char *new_name,
                CajaFileOperationCallback callback,
                gpointer callback_data)
{
    char *old_name, *wait_message;
    FMRenameData *data;
    char *uri;
    GError *error;

    g_return_if_fail (CAJA_IS_FILE (file));
    g_return_if_fail (new_name != NULL);

    /* Stop any earlier rename that's already in progress. */
    error = g_error_new (G_IO_ERROR, G_IO_ERROR_CANCELLED, "Cancelled");
    finish_rename (file, TRUE, error);
    g_error_free (error);

    data = g_new0 (FMRenameData, 1);
    data->name = g_strdup (new_name);
    data->callback = callback;
    data->callback_data = callback_data;

    /* Attach the new name to the file. */
    g_object_set_data_full (G_OBJECT (file),
                            NEW_NAME_TAG,
                            data, (GDestroyNotify)fm_rename_data_free);

    /* Start the timed wait to cancel the rename. */
    old_name = caja_file_get_display_name (file);
    wait_message = g_strdup_printf (_("Renaming \"%s\" to \"%s\"."),
                                    old_name,
                                    new_name);
    g_free (old_name);
    eel_timed_wait_start (cancel_rename_callback, file, wait_message,
                          NULL); /* FIXME bugzilla.gnome.org 42395: Parent this? */
    g_free (wait_message);

    uri = caja_file_get_uri (file);
    caja_debug_log (FALSE, CAJA_DEBUG_LOG_DOMAIN_USER,
                    "rename file old=\"%s\", new=\"%s\"",
                    uri, new_name);
    g_free (uri);

    /* Start the rename. */
    caja_file_rename (file, new_name,
                      rename_callback, NULL);
}
static void
log_override_cb (const gchar   *log_domain,
                 GLogLevelFlags log_level,
                 const gchar   *message,
                 gpointer       user_data)
{
    gboolean is_debug;
    gboolean is_milestone;

    is_debug = ((log_level & G_LOG_LEVEL_DEBUG) != 0);
    is_milestone = !is_debug;

    caja_debug_log (is_milestone, CAJA_DEBUG_LOG_DOMAIN_GLOG, "%s", message);

    if (!is_debug)
        (* default_log_handler) (log_domain, log_level, message, user_data);
}
static void
sigfatal_handler (int sig)
{
    void (* func) (int);

    /* FIXME: is this totally busted?  We do malloc() inside these functions,
     * and yet we are inside a signal handler...
     */
    caja_debug_log (TRUE, CAJA_DEBUG_LOG_DOMAIN_USER,
                    "debug log dumped due to signal %d", sig);
    dump_debug_log ();

    switch (sig)
    {
    case SIGSEGV:
        func = old_segv_sa.sa_handler;
        break;

    case SIGABRT:
        func = old_abrt_sa.sa_handler;
        break;

    case SIGTRAP:
        func = old_trap_sa.sa_handler;
        break;

    case SIGFPE:
        func = old_fpe_sa.sa_handler;
        break;

    case SIGBUS:
        func = old_bus_sa.sa_handler;
        break;

    default:
        func = NULL;
        break;
    }

    /* this scares me */
    if (func != NULL && func != SIG_IGN && func != SIG_DFL)
        (* func) (sig);
}
static void sighup_handler (int sig)
{
    caja_debug_log (TRUE, CAJA_DEBUG_LOG_DOMAIN_USER,
                    "HUP signal received, reloading windows");

    GList *list_copy;
    GList *l;

    list_copy = g_list_copy (caja_application_get_window_list());

    for (l = list_copy; l != NULL; l = l->next)
    {   
        CajaWindow *window;

        window = CAJA_WINDOW (l->data);

        if (CAJA_IS_NAVIGATION_WINDOW (window))
        {   
            caja_window_reload (window);
        }
    }

}