~ubuntu-branches/ubuntu/hoary/gimp/hoary

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2005-04-04 14:51:23 UTC
  • Revision ID: james.westby@ubuntu.com-20050404145123-9py049eeelfymur8
Tags: upstream-2.2.2
ImportĀ upstreamĀ versionĀ 2.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* The GIMP -- an image manipulation program
 
2
 * Copyright (C) 1999 Manish Singh
 
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 "libgimpwidgets/gimpwidgets.h"
 
24
 
 
25
#include "display-types.h"
 
26
 
 
27
#include "gimpdisplayshell.h"
 
28
#include "gimpdisplayshell-filter.h"
 
29
 
 
30
 
 
31
/*  local function prototypes  */
 
32
 
 
33
static void   gimp_display_shell_filter_changed (GimpColorDisplayStack *stack,
 
34
                                                 GimpDisplayShell      *shell);
 
35
 
 
36
 
 
37
/*  public functions  */
 
38
 
 
39
void
 
40
gimp_display_shell_filter_set (GimpDisplayShell      *shell,
 
41
                               GimpColorDisplayStack *stack)
 
42
{
 
43
  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
 
44
  g_return_if_fail (stack == NULL || GIMP_IS_COLOR_DISPLAY_STACK (stack));
 
45
 
 
46
  if (stack == shell->filter_stack)
 
47
    return;
 
48
 
 
49
  if (shell->filter_stack)
 
50
    {
 
51
      g_signal_handlers_disconnect_by_func (shell->filter_stack,
 
52
                                            gimp_display_shell_filter_changed,
 
53
                                            shell);
 
54
 
 
55
      g_object_unref (shell->filter_stack);
 
56
    }
 
57
 
 
58
  shell->filter_stack = stack;
 
59
 
 
60
  if (shell->filter_stack)
 
61
    {
 
62
      g_object_ref (shell->filter_stack);
 
63
 
 
64
      g_signal_connect (shell->filter_stack, "changed",
 
65
                        G_CALLBACK (gimp_display_shell_filter_changed),
 
66
                        shell);
 
67
    }
 
68
 
 
69
  gimp_display_shell_filter_changed (NULL, shell);
 
70
}
 
71
 
 
72
 
 
73
/*  private functions  */
 
74
 
 
75
static gboolean
 
76
gimp_display_shell_filter_changed_idle (gpointer data)
 
77
{
 
78
  GimpDisplayShell *shell = data;
 
79
 
 
80
  gimp_display_shell_expose_full (shell);
 
81
  shell->filter_idle_id = 0;
 
82
 
 
83
  return FALSE;
 
84
}
 
85
 
 
86
static void
 
87
gimp_display_shell_filter_changed (GimpColorDisplayStack *stack,
 
88
                                   GimpDisplayShell      *shell)
 
89
{
 
90
  if (shell->filter_idle_id)
 
91
    g_source_remove (shell->filter_idle_id);
 
92
 
 
93
  shell->filter_idle_id =
 
94
    g_idle_add_full (G_PRIORITY_LOW,
 
95
                     gimp_display_shell_filter_changed_idle,
 
96
                     shell, NULL);
 
97
}