app/display/Makefile.am new files, implementing the GimpProgress interface

2006-06-29  Sven Neumann  <sven@gimp.org>

	* app/display/Makefile.am
	* app/display/gimpdisplayshell-progress.[ch]: new files,
	implementing the GimpProgress interface by delegation to
	GimpStatusbar.

	* app/display/gimpdisplayshell.c (G_DEFINE_TYPE): call
	gimp_display_shell_progress_iface_init().

	* app/display/gimpdisplay.c: delegate progress calls to
	GimpDisplayShell instead of shell->statusbar.
This commit is contained in:
Sven Neumann 2006-06-29 09:42:05 +00:00 committed by Sven Neumann
parent f8e16bb2d4
commit 353ca7adf3
6 changed files with 179 additions and 51 deletions

View File

@ -1,3 +1,16 @@
2006-06-29 Sven Neumann <sven@gimp.org>
* app/display/Makefile.am
* app/display/gimpdisplayshell-progress.[ch]: new files,
implementing the GimpProgress interface by delegation to
GimpStatusbar.
* app/display/gimpdisplayshell.c (G_DEFINE_TYPE): call
gimp_display_shell_progress_iface_init().
* app/display/gimpdisplay.c: delegate progress calls to
GimpDisplayShell instead of shell->statusbar.
2006-06-29 Raphaël Quinet <raphael@gimp.org>
* plug-ins/common/screenshot.c (select_window_x11): allow the

View File

@ -43,6 +43,8 @@ libappdisplay_a_sources = \
gimpdisplayshell-layer-select.h \
gimpdisplayshell-preview.c \
gimpdisplayshell-preview.h \
gimpdisplayshell-progress.c \
gimpdisplayshell-progress.h \
gimpdisplayshell-render.c \
gimpdisplayshell-render.h \
gimpdisplayshell-scale.c \

View File

@ -29,8 +29,6 @@
#include "core/gimplist.h"
#include "core/gimpprogress.h"
#include "widgets/gimpwidgets-utils.h"
#include "tools/gimptool.h"
#include "tools/tool_manager.h"
@ -204,102 +202,73 @@ gimp_display_progress_start (GimpProgress *progress,
const gchar *message,
gboolean cancelable)
{
GimpDisplay *display = GIMP_DISPLAY (progress);
GimpDisplayShell *shell;
GimpDisplay *display = GIMP_DISPLAY (progress);
if (! display->shell)
return NULL;
shell = GIMP_DISPLAY_SHELL (display->shell);
return gimp_progress_start (GIMP_PROGRESS (shell->statusbar),
return gimp_progress_start (GIMP_PROGRESS (display->shell),
message, cancelable);
}
static void
gimp_display_progress_end (GimpProgress *progress)
{
GimpDisplay *display = GIMP_DISPLAY (progress);
GimpDisplayShell *shell;
GimpDisplay *display = GIMP_DISPLAY (progress);
if (! display->shell)
return;
shell = GIMP_DISPLAY_SHELL (display->shell);
gimp_progress_end (GIMP_PROGRESS (shell->statusbar));
if (display->shell)
gimp_progress_end (GIMP_PROGRESS (display->shell));
}
static gboolean
gimp_display_progress_is_active (GimpProgress *progress)
{
GimpDisplay *display = GIMP_DISPLAY (progress);
GimpDisplayShell *shell;
GimpDisplay *display = GIMP_DISPLAY (progress);
if (! display->shell)
return FALSE;
shell = GIMP_DISPLAY_SHELL (display->shell);
return gimp_progress_is_active (GIMP_PROGRESS (shell->statusbar));
return gimp_progress_is_active (GIMP_PROGRESS (display->shell));
}
static void
gimp_display_progress_set_text (GimpProgress *progress,
const gchar *message)
{
GimpDisplay *display = GIMP_DISPLAY (progress);
GimpDisplayShell *shell;
GimpDisplay *display = GIMP_DISPLAY (progress);
if (! display->shell)
return;
shell = GIMP_DISPLAY_SHELL (display->shell);
gimp_progress_set_text (GIMP_PROGRESS (shell->statusbar), message);
if (display->shell)
gimp_progress_set_text (GIMP_PROGRESS (display->shell), message);
}
static void
gimp_display_progress_set_value (GimpProgress *progress,
gdouble percentage)
{
GimpDisplay *display = GIMP_DISPLAY (progress);
GimpDisplayShell *shell;
GimpDisplay *display = GIMP_DISPLAY (progress);
if (! display->shell)
return;
shell = GIMP_DISPLAY_SHELL (display->shell);
gimp_progress_set_value (GIMP_PROGRESS (shell->statusbar), percentage);
if (display->shell)
gimp_progress_set_value (GIMP_PROGRESS (display->shell), percentage);
}
static gdouble
gimp_display_progress_get_value (GimpProgress *progress)
{
GimpDisplay *display = GIMP_DISPLAY (progress);
GimpDisplayShell *shell;
GimpDisplay *display = GIMP_DISPLAY (progress);
if (! display->shell)
return 0.0;
shell = GIMP_DISPLAY_SHELL (display->shell);
return gimp_progress_get_value (GIMP_PROGRESS (shell->statusbar));
return gimp_progress_get_value (GIMP_PROGRESS (display->shell));
}
static void
gimp_display_progress_pulse (GimpProgress *progress)
{
GimpDisplay *display = GIMP_DISPLAY (progress);
GimpDisplayShell *shell;
GimpDisplay *display = GIMP_DISPLAY (progress);
if (! display->shell)
return;
shell = GIMP_DISPLAY_SHELL (display->shell);
gimp_progress_pulse (GIMP_PROGRESS (shell->statusbar));
if (display->shell)
gimp_progress_pulse (GIMP_PROGRESS (display->shell));
}
static guint32
@ -310,7 +279,7 @@ gimp_display_progress_get_window (GimpProgress *progress)
if (! display->shell)
return 0;
return (guint32) gimp_window_get_native (GTK_WINDOW (display->shell));
return gimp_progress_get_window (GIMP_PROGRESS (display->shell));
}
static void

View File

@ -0,0 +1,113 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "display-types.h"
#include "core/gimpprogress.h"
#include "widgets/gimpwidgets-utils.h"
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-progress.h"
static GimpProgress *
gimp_display_shell_progress_start (GimpProgress *progress,
const gchar *message,
gboolean cancelable)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
return gimp_progress_start (GIMP_PROGRESS (shell->statusbar),
message, cancelable);
}
static void
gimp_display_shell_progress_end (GimpProgress *progress)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
gimp_progress_end (GIMP_PROGRESS (shell->statusbar));
}
static gboolean
gimp_display_shell_progress_is_active (GimpProgress *progress)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
return gimp_progress_is_active (GIMP_PROGRESS (shell->statusbar));
}
static void
gimp_display_shell_progress_set_text (GimpProgress *progress,
const gchar *message)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
gimp_progress_set_text (GIMP_PROGRESS (shell->statusbar), message);
}
static void
gimp_display_shell_progress_set_value (GimpProgress *progress,
gdouble percentage)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
gimp_progress_set_value (GIMP_PROGRESS (shell->statusbar), percentage);
}
static gdouble
gimp_display_shell_progress_get_value (GimpProgress *progress)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
return gimp_progress_get_value (GIMP_PROGRESS (shell->statusbar));
}
static void
gimp_display_shell_progress_pulse (GimpProgress *progress)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
gimp_progress_pulse (GIMP_PROGRESS (shell->statusbar));
}
static guint32
gimp_display_shell_progress_get_window (GimpProgress *progress)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (progress);
return (guint32) gimp_window_get_native (GTK_WINDOW (shell));
}
void
gimp_display_shell_progress_iface_init (GimpProgressInterface *iface)
{
iface->start = gimp_display_shell_progress_start;
iface->end = gimp_display_shell_progress_end;
iface->is_active = gimp_display_shell_progress_is_active;
iface->set_text = gimp_display_shell_progress_set_text;
iface->set_value = gimp_display_shell_progress_set_value;
iface->get_value = gimp_display_shell_progress_get_value;
iface->pulse = gimp_display_shell_progress_pulse;
iface->get_window = gimp_display_shell_progress_get_window;
}

View File

@ -0,0 +1,28 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_DISPLAY_SHELL_PROGRESS_H__
#define __GIMP_DISPLAY_SHELL_PROGRESS_H__
#include "core/gimpprogress.h"
void gimp_display_shell_progress_iface_init (GimpProgressInterface *iface);
#endif /* __GIMP_DISPLAY_SHELL_PROGRESS_H__ */

View File

@ -63,6 +63,7 @@
#include "gimpdisplayshell-draw.h"
#include "gimpdisplayshell-filter.h"
#include "gimpdisplayshell-handlers.h"
#include "gimpdisplayshell-progress.h"
#include "gimpdisplayshell-scale.h"
#include "gimpdisplayshell-selection.h"
#include "gimpdisplayshell-title.h"
@ -121,7 +122,9 @@ static void gimp_display_shell_hide_tooltip (GimpUIManager *manager,
GimpDisplayShell *shell);
G_DEFINE_TYPE (GimpDisplayShell, gimp_display_shell, GTK_TYPE_WINDOW)
G_DEFINE_TYPE_WITH_CODE (GimpDisplayShell, gimp_display_shell, GTK_TYPE_WINDOW,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_PROGRESS,
gimp_display_shell_progress_iface_init))
#define parent_class gimp_display_shell_parent_class