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:
@ -22,19 +22,10 @@
|
|||||||
|
|
||||||
#include "display-types.h"
|
#include "display-types.h"
|
||||||
|
|
||||||
#include "config/gimpdisplayconfig.h"
|
|
||||||
|
|
||||||
#include "core/gimpimage.h"
|
#include "core/gimpimage.h"
|
||||||
|
|
||||||
#include "file/file-utils.h"
|
|
||||||
|
|
||||||
#include "gimpdisplay.h"
|
#include "gimpdisplay.h"
|
||||||
#include "gimpdisplay-handlers.h"
|
#include "gimpdisplay-handlers.h"
|
||||||
#include "gimpdisplayshell.h"
|
|
||||||
#include "gimpimagewindow.h"
|
|
||||||
#include "gimpstatusbar.h"
|
|
||||||
|
|
||||||
#include "gimp-intl.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
@ -49,12 +40,6 @@ static void gimp_display_update_handler (GimpProjection *projection,
|
|||||||
static void gimp_display_flush_handler (GimpImage *image,
|
static void gimp_display_flush_handler (GimpImage *image,
|
||||||
gboolean invalidate_preview,
|
gboolean invalidate_preview,
|
||||||
GimpDisplay *display);
|
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 */
|
/* public functions */
|
||||||
@ -87,12 +72,6 @@ gimp_display_connect (GimpDisplay *display,
|
|||||||
g_signal_connect (image, "flush",
|
g_signal_connect (image, "flush",
|
||||||
G_CALLBACK (gimp_display_flush_handler),
|
G_CALLBACK (gimp_display_flush_handler),
|
||||||
display);
|
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
|
void
|
||||||
@ -105,12 +84,6 @@ gimp_display_disconnect (GimpDisplay *display)
|
|||||||
|
|
||||||
image = display->image;
|
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,
|
g_signal_handlers_disconnect_by_func (image,
|
||||||
gimp_display_flush_handler,
|
gimp_display_flush_handler,
|
||||||
display);
|
display);
|
||||||
@ -157,44 +130,3 @@ gimp_display_flush_handler (GimpImage *image,
|
|||||||
{
|
{
|
||||||
gimp_display_flush (display);
|
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -34,6 +34,8 @@
|
|||||||
#include "core/gimpitem.h"
|
#include "core/gimpitem.h"
|
||||||
#include "core/gimptreehandler.h"
|
#include "core/gimptreehandler.h"
|
||||||
|
|
||||||
|
#include "file/file-utils.h"
|
||||||
|
|
||||||
#include "widgets/gimpwidgets-utils.h"
|
#include "widgets/gimpwidgets-utils.h"
|
||||||
|
|
||||||
#include "gimpdisplay.h"
|
#include "gimpdisplay.h"
|
||||||
@ -49,6 +51,9 @@
|
|||||||
#include "gimpdisplayshell-selection.h"
|
#include "gimpdisplayshell-selection.h"
|
||||||
#include "gimpdisplayshell-title.h"
|
#include "gimpdisplayshell-title.h"
|
||||||
#include "gimpimagewindow.h"
|
#include "gimpimagewindow.h"
|
||||||
|
#include "gimpstatusbar.h"
|
||||||
|
|
||||||
|
#include "gimp-intl.h"
|
||||||
|
|
||||||
|
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
@ -89,6 +94,12 @@ static void gimp_display_shell_invalidate_preview_handler (GimpImage *i
|
|||||||
GimpDisplayShell *shell);
|
GimpDisplayShell *shell);
|
||||||
static void gimp_display_shell_profile_changed_handler (GimpColorManaged *image,
|
static void gimp_display_shell_profile_changed_handler (GimpColorManaged *image,
|
||||||
GimpDisplayShell *shell);
|
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,
|
static void gimp_display_shell_vectors_freeze_handler (GimpVectors *vectors,
|
||||||
GimpDisplayShell *shell);
|
GimpDisplayShell *shell);
|
||||||
@ -178,6 +189,12 @@ gimp_display_shell_connect (GimpDisplayShell *shell)
|
|||||||
g_signal_connect (image, "profile-changed",
|
g_signal_connect (image, "profile-changed",
|
||||||
G_CALLBACK (gimp_display_shell_profile_changed_handler),
|
G_CALLBACK (gimp_display_shell_profile_changed_handler),
|
||||||
shell);
|
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 =
|
shell->vectors_freeze_handler =
|
||||||
gimp_tree_handler_connect (image->vectors, "freeze",
|
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);
|
gimp_tree_handler_disconnect (shell->vectors_freeze_handler);
|
||||||
shell->vectors_freeze_handler = NULL;
|
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,
|
g_signal_handlers_disconnect_by_func (image,
|
||||||
gimp_display_shell_profile_changed_handler,
|
gimp_display_shell_profile_changed_handler,
|
||||||
shell);
|
shell);
|
||||||
@ -556,6 +579,45 @@ gimp_display_shell_profile_changed_handler (GimpColorManaged *image,
|
|||||||
gimp_color_managed_profile_changed (GIMP_COLOR_MANAGED (shell));
|
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
|
static void
|
||||||
gimp_display_shell_vectors_freeze_handler (GimpVectors *vectors,
|
gimp_display_shell_vectors_freeze_handler (GimpVectors *vectors,
|
||||||
GimpDisplayShell *shell)
|
GimpDisplayShell *shell)
|
||||||
|
Reference in New Issue
Block a user