~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to app/display/gimpdisplayshell-progress.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* GIMP - The GNU Image Manipulation Program
 
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; either version 2 of the License, or
 
7
 * (at your option) any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
17
 */
 
18
 
 
19
#include "config.h"
 
20
 
 
21
#include <gtk/gtk.h>
 
22
 
 
23
#include "display-types.h"
 
24
 
 
25
#include "core/gimpprogress.h"
 
26
 
 
27
#include "widgets/gimpwidgets-utils.h"
 
28
 
 
29
#include "gimpdisplayshell.h"
 
30
#include "gimpdisplayshell-progress.h"
 
31
#include "gimpstatusbar.h"
 
32
 
 
33
 
 
34
static GimpProgress *
 
35
gimp_display_shell_progress_start (GimpProgress *progress,
 
36
                                   const gchar  *message,
 
37
                                   gboolean      cancelable)
 
38
{
 
39
  GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
 
40
 
 
41
  return gimp_progress_start (GIMP_PROGRESS (shell->statusbar),
 
42
                              message, cancelable);
 
43
}
 
44
 
 
45
static void
 
46
gimp_display_shell_progress_end (GimpProgress *progress)
 
47
{
 
48
  GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
 
49
 
 
50
  gimp_progress_end (GIMP_PROGRESS (shell->statusbar));
 
51
}
 
52
 
 
53
static gboolean
 
54
gimp_display_shell_progress_is_active (GimpProgress *progress)
 
55
{
 
56
  GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
 
57
 
 
58
  return gimp_progress_is_active (GIMP_PROGRESS (shell->statusbar));
 
59
}
 
60
 
 
61
static void
 
62
gimp_display_shell_progress_set_text (GimpProgress *progress,
 
63
                                      const gchar  *message)
 
64
{
 
65
  GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
 
66
 
 
67
  gimp_progress_set_text (GIMP_PROGRESS (shell->statusbar), message);
 
68
}
 
69
 
 
70
static void
 
71
gimp_display_shell_progress_set_value (GimpProgress *progress,
 
72
                                       gdouble       percentage)
 
73
{
 
74
  GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
 
75
 
 
76
  gimp_progress_set_value (GIMP_PROGRESS (shell->statusbar), percentage);
 
77
}
 
78
 
 
79
static gdouble
 
80
gimp_display_shell_progress_get_value (GimpProgress *progress)
 
81
{
 
82
  GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
 
83
 
 
84
  return gimp_progress_get_value (GIMP_PROGRESS (shell->statusbar));
 
85
}
 
86
 
 
87
static void
 
88
gimp_display_shell_progress_pulse (GimpProgress *progress)
 
89
{
 
90
  GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
 
91
 
 
92
  gimp_progress_pulse (GIMP_PROGRESS (shell->statusbar));
 
93
}
 
94
 
 
95
static guint32
 
96
gimp_display_shell_progress_get_window (GimpProgress *progress)
 
97
{
 
98
  GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
 
99
 
 
100
  return (guint32) gimp_window_get_native (GTK_WINDOW (shell));
 
101
}
 
102
 
 
103
static gboolean
 
104
gimp_display_shell_progress_message (GimpProgress        *progress,
 
105
                                     Gimp                *gimp,
 
106
                                     GimpMessageSeverity  severity,
 
107
                                     const gchar         *domain,
 
108
                                     const gchar         *message)
 
109
{
 
110
  GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
 
111
 
 
112
  switch (severity)
 
113
    {
 
114
    case GIMP_MESSAGE_ERROR:
 
115
      /* error messages are never handled here */
 
116
      break;
 
117
 
 
118
    case GIMP_MESSAGE_WARNING:
 
119
      /* warning messages go to the statusbar, if it's visible */
 
120
      if (! GTK_WIDGET_VISIBLE (shell->statusbar))
 
121
        break;
 
122
      /* else fallthrough */
 
123
 
 
124
    case GIMP_MESSAGE_INFO:
 
125
      /* info messages go to the statusbar, no matter if it's visible or not */
 
126
      return gimp_progress_message (GIMP_PROGRESS (shell->statusbar), gimp,
 
127
                                    severity, domain, message);
 
128
    }
 
129
 
 
130
  return FALSE;
 
131
}
 
132
 
 
133
void
 
134
gimp_display_shell_progress_iface_init (GimpProgressInterface *iface)
 
135
{
 
136
  iface->start      = gimp_display_shell_progress_start;
 
137
  iface->end        = gimp_display_shell_progress_end;
 
138
  iface->is_active  = gimp_display_shell_progress_is_active;
 
139
  iface->set_text   = gimp_display_shell_progress_set_text;
 
140
  iface->set_value  = gimp_display_shell_progress_set_value;
 
141
  iface->get_value  = gimp_display_shell_progress_get_value;
 
142
  iface->pulse      = gimp_display_shell_progress_pulse;
 
143
  iface->get_window = gimp_display_shell_progress_get_window;
 
144
  iface->message    = gimp_display_shell_progress_message;
 
145
}