void
error_console_highlight_info_cmd_callback (GtkAction *action,
                                           gpointer   data)
{
  GimpErrorConsole *console = GIMP_ERROR_CONSOLE (data);
  gboolean          active;

  active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));

  g_object_set (console->gimp->config,
                "error-console-highlight-info", active,
                NULL);
}
Beispiel #2
0
static gboolean
gui_message_error_console (Gimp                *gimp,
                           GimpMessageSeverity  severity,
                           const gchar         *domain,
                           const gchar         *message)
{
    GtkWidget *dockable = NULL;

    /* try to avoid raising the error console for not so severe messages */
    if (severity < GIMP_MESSAGE_ERROR)
    {
        GtkWidget *widget =
            gimp_dialog_factory_find_widget (gimp_dialog_factory_get_singleton (),
                                             "gimp-error-console");
        if (GIMP_IS_DOCKABLE (widget))
            dockable = widget;
    }

    if (! dockable)
    {
        GdkScreen *screen;
        gint       monitor;

        monitor = gimp_get_monitor_at_pointer (&screen);

        dockable =
            gimp_window_strategy_show_dockable_dialog (GIMP_WINDOW_STRATEGY (gimp_get_window_strategy (gimp)),
                    gimp,
                    gimp_dialog_factory_get_singleton (),
                    screen, monitor,
                    "gimp-error-console");
    }

    if (dockable)
    {
        GtkWidget *child = gtk_bin_get_child (GTK_BIN (dockable));

        gimp_error_console_add (GIMP_ERROR_CONSOLE (child),
                                severity, domain, message);

        return TRUE;
    }

    return FALSE;
}
Beispiel #3
0
static void
gimp_error_console_constructed (GObject *object)
{
  GimpErrorConsole *console = GIMP_ERROR_CONSOLE (object);

  G_OBJECT_CLASS (parent_class)->constructed (object);

  console->clear_button =
    gimp_editor_add_action_button (GIMP_EDITOR (console), "error-console",
                                   "error-console-clear", NULL);

  console->save_button =
    gimp_editor_add_action_button (GIMP_EDITOR (console), "error-console",
                                   "error-console-save-all",
                                   "error-console-save-selection",
                                   GDK_SHIFT_MASK,
                                   NULL);
}
Beispiel #4
0
void
error_console_actions_update (GimpActionGroup *group,
                              gpointer         data)
{
  GimpErrorConsole *console = GIMP_ERROR_CONSOLE (data);
  gboolean          selection;

  selection = gtk_text_buffer_get_selection_bounds (console->text_buffer,
                                                    NULL, NULL);

#define SET_SENSITIVE(action,condition) \
        gimp_action_group_set_action_sensitive (group, action, (condition) != 0)

  SET_SENSITIVE ("error-console-clear",          TRUE);
  SET_SENSITIVE ("error-console-select-all",     TRUE);
  SET_SENSITIVE ("error-console-save-all",       TRUE);
  SET_SENSITIVE ("error-console-save-selection", selection);

#undef SET_SENSITIVE
}
Beispiel #5
0
static gboolean
gui_message_error_console (GimpMessageSeverity  severity,
                           const gchar         *domain,
                           const gchar         *message)
{
  GtkWidget *dockable = NULL;

  /* try to avoid raising the error console for not so severe messages */
  if (severity < GIMP_MESSAGE_ERROR)
    {
      GimpSessionInfo *info;

      info = gimp_dialog_factory_find_session_info (global_dock_factory,
                                                    "gimp-error-console");

      if (info && GIMP_IS_DOCKABLE (info->widget))
        dockable = info->widget;
    }

  if (! dockable)
    dockable = gimp_dialog_factory_dialog_raise (global_dock_factory,
                                                 gdk_screen_get_default (),
                                                 "gimp-error-console", -1);

  if (dockable)
    {
      GtkWidget *child = gtk_bin_get_child (GTK_BIN (dockable));

      gimp_error_console_add (GIMP_ERROR_CONSOLE (child),
                              severity, domain, message);

      return TRUE;
    }

  return FALSE;
}
void
error_console_save_cmd_callback (GtkAction *action,
                                 gint       value,
                                 gpointer   data)
{
  GimpErrorConsole *console = GIMP_ERROR_CONSOLE (data);
  GtkFileChooser   *chooser;

  if (value && ! gtk_text_buffer_get_selection_bounds (console->text_buffer,
                                                       NULL, NULL))
    {
      gimp_message (console->gimp, G_OBJECT (console), GIMP_MESSAGE_WARNING,
                    _("Cannot save. Nothing is selected."));
      return;
    }

  if (console->file_dialog)
    {
      gtk_window_present (GTK_WINDOW (console->file_dialog));
      return;
    }

  console->file_dialog =
    gtk_file_chooser_dialog_new (_("Save Error Log to File"), NULL,
                                 GTK_FILE_CHOOSER_ACTION_SAVE,

                                 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                                 GTK_STOCK_SAVE,   GTK_RESPONSE_OK,

                                 NULL);

  gtk_dialog_set_alternative_button_order (GTK_DIALOG (console->file_dialog),
                                           GTK_RESPONSE_OK,
                                           GTK_RESPONSE_CANCEL,
                                           -1);

  console->save_selection = value;

  g_object_add_weak_pointer (G_OBJECT (console->file_dialog),
                             (gpointer) &console->file_dialog);

  chooser = GTK_FILE_CHOOSER (console->file_dialog);

  gtk_window_set_screen (GTK_WINDOW (chooser),
                         gtk_widget_get_screen (GTK_WIDGET (console)));

  gtk_window_set_position (GTK_WINDOW (chooser), GTK_WIN_POS_MOUSE);
  gtk_window_set_role (GTK_WINDOW (chooser), "gimp-save-errors");

  gtk_dialog_set_default_response (GTK_DIALOG (chooser), GTK_RESPONSE_OK);
  gtk_file_chooser_set_do_overwrite_confirmation (chooser, TRUE);

  g_signal_connect (chooser, "response",
                    G_CALLBACK (error_console_save_response),
                    console);
  g_signal_connect (chooser, "delete-event",
                    G_CALLBACK (gtk_true),
                    NULL);

  gimp_help_connect (GTK_WIDGET (chooser), gimp_standard_help_func,
                     GIMP_HELP_ERRORS_DIALOG, NULL);

  gtk_widget_show (GTK_WIDGET (chooser));
}