Move GimpImage::saved and GimpImage::exported handlers to the right place

GimpDisplay is *only* for proxying the image's projection, every other
image/display connection belongs into GimpDisplayShell, so move these
handlers from gimpdisplay-handlers.c to gimpdisplayshell-handlers.c.
This commit is contained in:
Michael Natterer 2009-09-29 22:38:34 +02:00
parent 35588efaa1
commit 3189b8f45f
2 changed files with 62 additions and 68 deletions

View File

@ -22,19 +22,10 @@
#include "display-types.h"
#include "config/gimpdisplayconfig.h"
#include "core/gimpimage.h"
#include "file/file-utils.h"
#include "gimpdisplay.h"
#include "gimpdisplay-handlers.h"
#include "gimpdisplayshell.h"
#include "gimpimagewindow.h"
#include "gimpstatusbar.h"
#include "gimp-intl.h"
/* local function prototypes */
@ -49,12 +40,6 @@ static void gimp_display_update_handler (GimpProjection *projection,
static void gimp_display_flush_handler (GimpImage *image,
gboolean invalidate_preview,
GimpDisplay *display);
static void gimp_display_saved_handler (GimpImage *image,
const gchar *uri,
GimpDisplay *display);
static void gimp_display_exported_handler (GimpImage *image,
const gchar *uri,
GimpDisplay *display);
/* public functions */
@ -87,12 +72,6 @@ gimp_display_connect (GimpDisplay *display,
g_signal_connect (image, "flush",
G_CALLBACK (gimp_display_flush_handler),
display);
g_signal_connect (image, "saved",
G_CALLBACK (gimp_display_saved_handler),
display);
g_signal_connect (image, "exported",
G_CALLBACK (gimp_display_exported_handler),
display);
}
void
@ -105,12 +84,6 @@ gimp_display_disconnect (GimpDisplay *display)
image = display->image;
g_signal_handlers_disconnect_by_func (image,
gimp_display_saved_handler,
display);
g_signal_handlers_disconnect_by_func (image,
gimp_display_exported_handler,
display);
g_signal_handlers_disconnect_by_func (image,
gimp_display_flush_handler,
display);
@ -157,44 +130,3 @@ gimp_display_flush_handler (GimpImage *image,
{
gimp_display_flush (display);
}
static void
gimp_display_saved_handler (GimpImage *image,
const gchar *uri,
GimpDisplay *display)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (display->shell);
GimpImageWindow *window = gimp_display_shell_get_window (shell);
if (window && gimp_image_window_get_active_shell (window) == shell)
{
GimpStatusbar *statusbar = gimp_image_window_get_statusbar (window);
gchar *filename = file_utils_uri_display_name (uri);
gimp_statusbar_push_temp (statusbar, GIMP_MESSAGE_INFO,
GTK_STOCK_SAVE, _("Image saved to '%s'"),
filename);
g_free (filename);
}
}
static void
gimp_display_exported_handler (GimpImage *image,
const gchar *uri,
GimpDisplay *display)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (display->shell);
GimpImageWindow *window = gimp_display_shell_get_window (shell);
if (window && gimp_image_window_get_active_shell (window) == shell)
{
GimpStatusbar *statusbar = gimp_image_window_get_statusbar (window);
gchar *filename = file_utils_uri_display_name (uri);
gimp_statusbar_push_temp (statusbar, GIMP_MESSAGE_INFO,
GTK_STOCK_SAVE, _("Image exported to '%s'"),
filename);
g_free (filename);
}
}

View File

@ -34,6 +34,8 @@
#include "core/gimpitem.h"
#include "core/gimptreehandler.h"
#include "file/file-utils.h"
#include "widgets/gimpwidgets-utils.h"
#include "gimpdisplay.h"
@ -49,6 +51,9 @@
#include "gimpdisplayshell-selection.h"
#include "gimpdisplayshell-title.h"
#include "gimpimagewindow.h"
#include "gimpstatusbar.h"
#include "gimp-intl.h"
/* local function prototypes */
@ -89,6 +94,12 @@ static void gimp_display_shell_invalidate_preview_handler (GimpImage *i
GimpDisplayShell *shell);
static void gimp_display_shell_profile_changed_handler (GimpColorManaged *image,
GimpDisplayShell *shell);
static void gimp_display_shell_saved_handler (GimpImage *image,
const gchar *uri,
GimpDisplayShell *shell);
static void gimp_display_shell_exported_handler (GimpImage *image,
const gchar *uri,
GimpDisplayShell *shell);
static void gimp_display_shell_vectors_freeze_handler (GimpVectors *vectors,
GimpDisplayShell *shell);
@ -178,6 +189,12 @@ gimp_display_shell_connect (GimpDisplayShell *shell)
g_signal_connect (image, "profile-changed",
G_CALLBACK (gimp_display_shell_profile_changed_handler),
shell);
g_signal_connect (image, "saved",
G_CALLBACK (gimp_display_shell_saved_handler),
shell);
g_signal_connect (image, "exported",
G_CALLBACK (gimp_display_shell_exported_handler),
shell);
shell->vectors_freeze_handler =
gimp_tree_handler_connect (image->vectors, "freeze",
@ -330,6 +347,12 @@ gimp_display_shell_disconnect (GimpDisplayShell *shell)
gimp_tree_handler_disconnect (shell->vectors_freeze_handler);
shell->vectors_freeze_handler = NULL;
g_signal_handlers_disconnect_by_func (image,
gimp_display_shell_exported_handler,
shell);
g_signal_handlers_disconnect_by_func (image,
gimp_display_shell_saved_handler,
shell);
g_signal_handlers_disconnect_by_func (image,
gimp_display_shell_profile_changed_handler,
shell);
@ -556,6 +579,45 @@ gimp_display_shell_profile_changed_handler (GimpColorManaged *image,
gimp_color_managed_profile_changed (GIMP_COLOR_MANAGED (shell));
}
static void
gimp_display_shell_saved_handler (GimpImage *image,
const gchar *uri,
GimpDisplayShell *shell)
{
GimpImageWindow *window = gimp_display_shell_get_window (shell);
if (window && gimp_image_window_get_active_shell (window) == shell)
{
GimpStatusbar *statusbar = gimp_image_window_get_statusbar (window);
gchar *filename = file_utils_uri_display_name (uri);
gimp_statusbar_push_temp (statusbar, GIMP_MESSAGE_INFO,
GTK_STOCK_SAVE, _("Image saved to '%s'"),
filename);
g_free (filename);
}
}
static void
gimp_display_shell_exported_handler (GimpImage *image,
const gchar *uri,
GimpDisplayShell *shell)
{
GimpImageWindow *window = gimp_display_shell_get_window (shell);
if (window && gimp_image_window_get_active_shell (window) == shell)
{
GimpStatusbar *statusbar = gimp_image_window_get_statusbar (window);
gchar *filename = file_utils_uri_display_name (uri);
gimp_statusbar_push_temp (statusbar, GIMP_MESSAGE_INFO,
GTK_STOCK_SAVE, _("Image exported to '%s'"),
filename);
g_free (filename);
}
}
static void
gimp_display_shell_vectors_freeze_handler (GimpVectors *vectors,
GimpDisplayShell *shell)