Commit 3972da52 authored by Michael Natterer's avatar Michael Natterer 😴

app: add signal GimpDisplayShell::rotated and use it to update the menu

parent b4a2cf94
......@@ -58,7 +58,7 @@ gimp_display_shell_rotate_to (GimpDisplayShell *shell,
shell->rotate_angle = value;
gimp_display_shell_rotate_update_transform (shell);
gimp_display_shell_rotated (shell);
gimp_display_shell_expose_full (shell);
}
......
......@@ -107,6 +107,7 @@ enum
{
SCALED,
SCROLLED,
ROTATED,
RECONNECT,
LAST_SIGNAL
};
......@@ -146,6 +147,7 @@ static void gimp_display_shell_screen_changed (GtkWidget *widget,
static gboolean gimp_display_shell_popup_menu (GtkWidget *widget);
static void gimp_display_shell_real_scaled (GimpDisplayShell *shell);
static void gimp_display_shell_real_rotated (GimpDisplayShell *shell);
static const guint8 * gimp_display_shell_get_icc_profile
(GimpColorManaged *managed,
......@@ -215,6 +217,15 @@ gimp_display_shell_class_init (GimpDisplayShellClass *klass)
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
display_shell_signals[ROTATED] =
g_signal_new ("rotated",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpDisplayShellClass, rotated),
NULL, NULL,
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
display_shell_signals[RECONNECT] =
g_signal_new ("reconnect",
G_TYPE_FROM_CLASS (klass),
......@@ -236,6 +247,7 @@ gimp_display_shell_class_init (GimpDisplayShellClass *klass)
klass->scaled = gimp_display_shell_real_scaled;
klass->scrolled = NULL;
klass->rotated = gimp_display_shell_real_rotated;
klass->reconnect = NULL;
g_object_class_install_property (object_class, PROP_POPUP_MANAGER,
......@@ -1010,6 +1022,20 @@ gimp_display_shell_real_scaled (GimpDisplayShell *shell)
gimp_ui_manager_update (shell->popup_manager, shell->display);
}
static void
gimp_display_shell_real_rotated (GimpDisplayShell *shell)
{
GimpContext *user_context;
if (! shell->display)
return;
user_context = gimp_get_user_context (shell->display->gimp);
if (shell->display == gimp_context_get_display (user_context))
gimp_ui_manager_update (shell->popup_manager, shell->display);
}
static const guint8 *
gimp_display_shell_get_icc_profile (GimpColorManaged *managed,
gsize *len)
......@@ -1473,6 +1499,16 @@ gimp_display_shell_scrolled (GimpDisplayShell *shell)
g_signal_emit (shell, display_shell_signals[SCROLLED], 0);
}
void
gimp_display_shell_rotated (GimpDisplayShell *shell)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
gimp_display_shell_rotate_update_transform (shell);
g_signal_emit (shell, display_shell_signals[ROTATED], 0);
}
void
gimp_display_shell_set_unit (GimpDisplayShell *shell,
GimpUnit unit)
......
......@@ -199,6 +199,7 @@ struct _GimpDisplayShellClass
void (* scaled) (GimpDisplayShell *shell);
void (* scrolled) (GimpDisplayShell *shell);
void (* rotated) (GimpDisplayShell *shell);
void (* reconnect) (GimpDisplayShell *shell);
};
......@@ -242,6 +243,7 @@ void gimp_display_shell_scale_changed (GimpDisplayShell *shell);
void gimp_display_shell_scaled (GimpDisplayShell *shell);
void gimp_display_shell_scrolled (GimpDisplayShell *shell);
void gimp_display_shell_rotated (GimpDisplayShell *shell);
void gimp_display_shell_set_unit (GimpDisplayShell *shell,
GimpUnit unit);
......
......@@ -209,6 +209,8 @@ static void gimp_image_window_image_notify (GimpDisplay *dis
GimpImageWindow *window);
static void gimp_image_window_shell_scaled (GimpDisplayShell *shell,
GimpImageWindow *window);
static void gimp_image_window_shell_rotated (GimpDisplayShell *shell,
GimpImageWindow *window);
static void gimp_image_window_shell_title_notify (GimpDisplayShell *shell,
const GParamSpec *pspec,
GimpImageWindow *window);
......@@ -1638,6 +1640,9 @@ gimp_image_window_switch_page (GtkNotebook *notebook,
g_signal_connect (private->active_shell, "scaled",
G_CALLBACK (gimp_image_window_shell_scaled),
window);
g_signal_connect (private->active_shell, "rotated",
G_CALLBACK (gimp_image_window_shell_rotated),
window);
g_signal_connect (private->active_shell, "notify::title",
G_CALLBACK (gimp_image_window_shell_title_notify),
window);
......@@ -1696,6 +1701,9 @@ gimp_image_window_disconnect_from_active_shell (GimpImageWindow *window)
g_signal_handlers_disconnect_by_func (private->active_shell,
gimp_image_window_shell_scaled,
window);
g_signal_handlers_disconnect_by_func (private->active_shell,
gimp_image_window_shell_rotated,
window);
g_signal_handlers_disconnect_by_func (private->active_shell,
gimp_image_window_shell_title_notify,
window);
......@@ -1884,6 +1892,17 @@ gimp_image_window_shell_scaled (GimpDisplayShell *shell,
shell->display);
}
static void
gimp_image_window_shell_rotated (GimpDisplayShell *shell,
GimpImageWindow *window)
{
GimpImageWindowPrivate *private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
/* update the <Image>/View/Rotate menu */
gimp_ui_manager_update (private->menubar_manager,
shell->display);
}
static void
gimp_image_window_shell_title_notify (GimpDisplayShell *shell,
const GParamSpec *pspec,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment