mirror of
https://gitlab.com/virt-viewer/virt-viewer.git
synced 2025-01-05 09:17:45 +03:00
src: introduce public helpers for changing zoom levels
This decouples the functional implementation from the UI controls that trigger it. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
29d0c7cecd
commit
825975d2e7
@ -451,10 +451,11 @@ virt_viewer_window_menu_machine_pause(GtkWidget *menu G_GNUC_UNUSED,
|
||||
virt_viewer_session_vm_action(virt_viewer_app_get_session(self->app), action);
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT void
|
||||
virt_viewer_window_menu_view_zoom_out(GtkWidget *menu G_GNUC_UNUSED,
|
||||
VirtViewerWindow *self)
|
||||
void
|
||||
virt_viewer_window_zoom_out(VirtViewerWindow *self)
|
||||
{
|
||||
g_return_if_fail(VIRT_VIEWER_IS_WINDOW(self));
|
||||
|
||||
if (VIRT_VIEWER_IS_DISPLAY_VTE(self->display)) {
|
||||
virt_viewer_display_vte_zoom_out(VIRT_VIEWER_DISPLAY_VTE(self->display));
|
||||
} else {
|
||||
@ -463,10 +464,11 @@ virt_viewer_window_menu_view_zoom_out(GtkWidget *menu G_GNUC_UNUSED,
|
||||
}
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT void
|
||||
virt_viewer_window_menu_view_zoom_in(GtkWidget *menu G_GNUC_UNUSED,
|
||||
VirtViewerWindow *self)
|
||||
void
|
||||
virt_viewer_window_zoom_in(VirtViewerWindow *self)
|
||||
{
|
||||
g_return_if_fail(VIRT_VIEWER_IS_WINDOW(self));
|
||||
|
||||
if (VIRT_VIEWER_IS_DISPLAY_VTE(self->display)) {
|
||||
virt_viewer_display_vte_zoom_in(VIRT_VIEWER_DISPLAY_VTE(self->display));
|
||||
} else {
|
||||
@ -475,10 +477,11 @@ virt_viewer_window_menu_view_zoom_in(GtkWidget *menu G_GNUC_UNUSED,
|
||||
}
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT void
|
||||
virt_viewer_window_menu_view_zoom_reset(GtkWidget *menu G_GNUC_UNUSED,
|
||||
VirtViewerWindow *self)
|
||||
void
|
||||
virt_viewer_window_zoom_reset(VirtViewerWindow *self)
|
||||
{
|
||||
g_return_if_fail(VIRT_VIEWER_IS_WINDOW(self));
|
||||
|
||||
if (VIRT_VIEWER_IS_DISPLAY_VTE(self->display)) {
|
||||
virt_viewer_display_vte_zoom_reset(VIRT_VIEWER_DISPLAY_VTE(self->display));
|
||||
} else {
|
||||
@ -486,6 +489,27 @@ virt_viewer_window_menu_view_zoom_reset(GtkWidget *menu G_GNUC_UNUSED,
|
||||
}
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT void
|
||||
virt_viewer_window_menu_view_zoom_out(GtkWidget *menu G_GNUC_UNUSED,
|
||||
VirtViewerWindow *self)
|
||||
{
|
||||
virt_viewer_window_zoom_out(self);
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT void
|
||||
virt_viewer_window_menu_view_zoom_in(GtkWidget *menu G_GNUC_UNUSED,
|
||||
VirtViewerWindow *self)
|
||||
{
|
||||
virt_viewer_window_zoom_in(self);
|
||||
}
|
||||
|
||||
G_MODULE_EXPORT void
|
||||
virt_viewer_window_menu_view_zoom_reset(GtkWidget *menu G_GNUC_UNUSED,
|
||||
VirtViewerWindow *self)
|
||||
{
|
||||
virt_viewer_window_zoom_reset(self);
|
||||
}
|
||||
|
||||
/* Kick GtkWindow to tell it to adjust to our new widget sizes */
|
||||
static void
|
||||
virt_viewer_window_queue_resize(VirtViewerWindow *self)
|
||||
@ -786,7 +810,7 @@ action_zoom_in(G_GNUC_UNUSED GSimpleAction *action,
|
||||
G_GNUC_UNUSED GVariant *state,
|
||||
gpointer user_data)
|
||||
{
|
||||
virt_viewer_window_menu_view_zoom_in(NULL, VIRT_VIEWER_WINDOW(user_data));
|
||||
virt_viewer_window_zoom_in(VIRT_VIEWER_WINDOW(user_data));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -794,7 +818,7 @@ action_zoom_out(G_GNUC_UNUSED GSimpleAction *action,
|
||||
G_GNUC_UNUSED GVariant *state,
|
||||
gpointer user_data)
|
||||
{
|
||||
virt_viewer_window_menu_view_zoom_out(NULL, VIRT_VIEWER_WINDOW(user_data));
|
||||
virt_viewer_window_zoom_out(VIRT_VIEWER_WINDOW(user_data));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -802,7 +826,7 @@ action_zoom_reset(G_GNUC_UNUSED GSimpleAction *action,
|
||||
G_GNUC_UNUSED GVariant *state,
|
||||
gpointer user_data)
|
||||
{
|
||||
virt_viewer_window_menu_view_zoom_reset(NULL, VIRT_VIEWER_WINDOW(user_data));
|
||||
virt_viewer_window_zoom_reset(VIRT_VIEWER_WINDOW(user_data));
|
||||
}
|
||||
|
||||
/* Keep keypad_action_entries and keypad_action_accels in sync */
|
||||
|
@ -54,6 +54,9 @@ void virt_viewer_window_update_title(VirtViewerWindow *self);
|
||||
void virt_viewer_window_show(VirtViewerWindow *self);
|
||||
void virt_viewer_window_hide(VirtViewerWindow *self);
|
||||
void virt_viewer_window_set_zoom_level(VirtViewerWindow *self, gint zoom_level);
|
||||
void virt_viewer_window_zoom_out(VirtViewerWindow *self);
|
||||
void virt_viewer_window_zoom_in(VirtViewerWindow *self);
|
||||
void virt_viewer_window_zoom_reset(VirtViewerWindow *self);
|
||||
gint virt_viewer_window_get_zoom_level(VirtViewerWindow *self);
|
||||
void virt_viewer_window_leave_fullscreen(VirtViewerWindow *self);
|
||||
void virt_viewer_window_enter_fullscreen(VirtViewerWindow *self, gint monitor);
|
||||
|
Loading…
Reference in New Issue
Block a user