Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
GNOME
gThumb
Commits
701a9f86
Commit
701a9f86
authored
Nov 17, 2019
by
Paolo Bacchilega
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slideshow: allow to customize the keyboard shortcuts
parent
0dad02e9
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
235 additions
and
127 deletions
+235
-127
extensions/slideshow/actions.c
extensions/slideshow/actions.c
+37
-0
extensions/slideshow/actions.h
extensions/slideshow/actions.h
+4
-0
extensions/slideshow/callbacks.c
extensions/slideshow/callbacks.c
+6
-1
extensions/slideshow/gth-slideshow.c
extensions/slideshow/gth-slideshow.c
+121
-120
extensions/slideshow/gth-slideshow.h
extensions/slideshow/gth-slideshow.h
+8
-2
extensions/slideshow/main.c
extensions/slideshow/main.c
+7
-0
extensions/slideshow/shortcuts.h
extensions/slideshow/shortcuts.h
+27
-0
gthumb/gth-main-default-types.c
gthumb/gth-main-default-types.c
+0
-1
gthumb/gth-shortcut.h
gthumb/gth-shortcut.h
+0
-1
gthumb/gth-shortcuts-window.c
gthumb/gth-shortcuts-window.c
+1
-1
gthumb/gth-window.c
gthumb/gth-window.c
+21
-1
gthumb/gth-window.h
gthumb/gth-window.h
+3
-0
No files found.
extensions/slideshow/actions.c
View file @
701a9f86
...
...
@@ -148,3 +148,40 @@ gth_browser_activate_slideshow (GSimpleAction *action,
_g_object_list_unref
(
file_list
);
_gtk_tree_path_list_free
(
items
);
}
void
gth_slideshow_activate_close
(
GSimpleAction
*
action
,
GVariant
*
parameter
,
gpointer
user_data
)
{
gth_slideshow_close
(
GTH_SLIDESHOW
(
user_data
));
}
void
gth_slideshow_activate_toggle_pause
(
GSimpleAction
*
action
,
GVariant
*
parameter
,
gpointer
user_data
)
{
gth_slideshow_toggle_pause
(
GTH_SLIDESHOW
(
user_data
));
}
void
gth_slideshow_activate_next_image
(
GSimpleAction
*
action
,
GVariant
*
parameter
,
gpointer
user_data
)
{
gth_slideshow_load_next_image
(
GTH_SLIDESHOW
(
user_data
));
}
void
gth_slideshow_activate_previous_image
(
GSimpleAction
*
action
,
GVariant
*
parameter
,
gpointer
user_data
)
{
gth_slideshow_load_prev_image
(
GTH_SLIDESHOW
(
user_data
));
}
extensions/slideshow/actions.h
View file @
701a9f86
...
...
@@ -25,5 +25,9 @@
#include <gthumb.h>
DEF_ACTION_CALLBACK
(
gth_browser_activate_slideshow
)
DEF_ACTION_CALLBACK
(
gth_slideshow_activate_close
)
DEF_ACTION_CALLBACK
(
gth_slideshow_activate_toggle_pause
)
DEF_ACTION_CALLBACK
(
gth_slideshow_activate_next_image
)
DEF_ACTION_CALLBACK
(
gth_slideshow_activate_previous_image
)
#endif
/* ACTIONS_H */
extensions/slideshow/callbacks.c
View file @
701a9f86
...
...
@@ -28,6 +28,7 @@
#include "callbacks.h"
#include "gth-slideshow-preferences.h"
#include "preferences.h"
#include "shortcuts.h"
static
const
GActionEntry
actions
[]
=
{
...
...
@@ -36,7 +37,11 @@ static const GActionEntry actions[] = {
static
const
GthShortcut
shortcuts
[]
=
{
{
"slideshow"
,
N_
(
"Presentation"
),
GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER
,
GTH_SHORTCUT_CATEGORY_FILE_MANAGER
,
"F5"
},
{
"slideshow"
,
N_
(
"Start presentation"
),
GTH_SHORTCUT_CONTEXT_BROWSER_VIEWER
,
GTH_SHORTCUT_CATEGORY_VIEWER
,
"F5"
},
{
"slideshow-close"
,
N_
(
"Terminate presentation"
),
GTH_SHORTCUT_CONTEXT_SLIDESHOW
,
GTH_SHORTCUT_CATEGORY_SLIDESHOW
,
"Escape"
},
{
"slideshow-toggle-pause"
,
N_
(
"Pause/Resume presentation"
),
GTH_SHORTCUT_CONTEXT_SLIDESHOW
,
GTH_SHORTCUT_CATEGORY_SLIDESHOW
,
"p"
},
{
"slideshow-next-image"
,
N_
(
"Show next file"
),
GTH_SHORTCUT_CONTEXT_SLIDESHOW
,
GTH_SHORTCUT_CATEGORY_SLIDESHOW
,
"space"
},
{
"slideshow-previous-image"
,
N_
(
"Show previous file"
),
GTH_SHORTCUT_CONTEXT_SLIDESHOW
,
GTH_SHORTCUT_CATEGORY_SLIDESHOW
,
"b"
},
};
...
...
extensions/slideshow/gth-slideshow.c
View file @
701a9f86
...
...
@@ -32,6 +32,7 @@
#endif
/* HAVE_GSTREAMER */
#include "gth-slideshow.h"
#include "gth-transition.h"
#include "actions.h"
#define HIDE_CURSOR_DELAY 1
#define HIDE_PAUSED_SIGN_DELAY 1
...
...
@@ -90,33 +91,16 @@ struct _GthSlideshowPrivate {
G_DEFINE_TYPE_WITH_CODE
(
GthSlideshow
,
gth_slideshow
,
GT
K
_TYPE_WINDOW
,
GT
H
_TYPE_WINDOW
,
G_ADD_PRIVATE
(
GthSlideshow
))
static
void
_gth_slideshow_close_cb
(
gpointer
user_data
)
{
GthSlideshow
*
self
=
user_data
;
gboolean
close_browser
;
GthBrowser
*
browser
;
browser
=
self
->
priv
->
browser
;
close_browser
=
!
gtk_widget_get_visible
(
GTK_WIDGET
(
browser
));
self
->
priv
->
projector
->
show_cursor
(
self
);
self
->
priv
->
projector
->
finalize
(
self
);
gtk_widget_destroy
(
GTK_WIDGET
(
self
));
if
(
close_browser
)
gth_window_close
(
GTH_WINDOW
(
browser
));
}
static
void
_gth_slideshow_close
(
GthSlideshow
*
self
)
{
call_when_idle
(
_gth_slideshow_close_cb
,
self
);
}
static
const
GActionEntry
actions
[]
=
{
{
"slideshow-close"
,
gth_slideshow_activate_close
},
{
"slideshow-toggle-pause"
,
gth_slideshow_activate_toggle_pause
},
{
"slideshow-next-image"
,
gth_slideshow_activate_next_image
},
{
"slideshow-previous-image"
,
gth_slideshow_activate_previous_image
},
};
static
int
...
...
@@ -141,9 +125,6 @@ _gth_slideshow_reset_current (GthSlideshow *self)
}
static
void
_gth_slideshow_load_next_image
(
GthSlideshow
*
self
);
static
void
preloader_load_ready_cb
(
GObject
*
source_object
,
GAsyncResult
*
result
,
...
...
@@ -167,7 +148,7 @@ preloader_load_ready_cb (GObject *source_object,
&
error
))
{
g_clear_error
(
&
error
);
_
gth_slideshow_load_next_image
(
self
);
gth_slideshow_load_next_image
(
self
);
return
;
}
...
...
@@ -175,7 +156,7 @@ preloader_load_ready_cb (GObject *source_object,
self
->
priv
->
current_pixbuf
=
gth_image_get_pixbuf
(
image
);
if
(
self
->
priv
->
current_pixbuf
==
NULL
)
{
_
gth_slideshow_load_next_image
(
self
);
gth_slideshow_load_next_image
(
self
);
return
;
}
...
...
@@ -203,7 +184,7 @@ _gth_slideshow_load_current_image (GthSlideshow *self)
if
(
self
->
priv
->
current
==
NULL
)
{
if
(
!
self
->
priv
->
one_loaded
||
!
self
->
priv
->
wrap_around
)
{
_
gth_slideshow_close
(
self
);
gth_slideshow_close
(
self
);
return
;
}
_gth_slideshow_reset_current
(
self
);
...
...
@@ -232,34 +213,6 @@ _gth_slideshow_load_current_image (GthSlideshow *self)
}
static
void
_gth_slideshow_load_next_image
(
GthSlideshow
*
self
)
{
self
->
priv
->
projector
->
load_next_image
(
self
);
self
->
priv
->
direction
=
GTH_SLIDESHOW_DIRECTION_FORWARD
;
if
(
self
->
priv
->
paused
)
return
;
self
->
priv
->
current
=
self
->
priv
->
current
->
next
;
_gth_slideshow_load_current_image
(
self
);
}
static
void
_gth_slideshow_load_prev_image
(
GthSlideshow
*
self
)
{
self
->
priv
->
projector
->
load_prev_image
(
self
);
self
->
priv
->
direction
=
GTH_SLIDESHOW_DIRECTION_BACKWARD
;
if
(
self
->
priv
->
paused
)
return
;
self
->
priv
->
current
=
self
->
priv
->
current
->
prev
;
_gth_slideshow_load_current_image
(
self
);
}
static
gboolean
next_image_cb
(
gpointer
user_data
)
{
...
...
@@ -269,7 +222,7 @@ next_image_cb (gpointer user_data)
g_source_remove
(
self
->
priv
->
next_event
);
self
->
priv
->
next_event
=
0
;
}
_
gth_slideshow_load_next_image
(
self
);
gth_slideshow_load_next_image
(
self
);
return
FALSE
;
}
...
...
@@ -352,27 +305,6 @@ hide_cursor_cb (gpointer data)
}
static
void
_gth_slideshow_toggle_pause
(
GthSlideshow
*
self
)
{
self
->
priv
->
paused
=
!
self
->
priv
->
paused
;
if
(
self
->
priv
->
paused
)
{
self
->
priv
->
projector
->
paused
(
self
);
#if HAVE_GSTREAMER
if
(
self
->
priv
->
playbin
!=
NULL
)
gst_element_set_state
(
self
->
priv
->
playbin
,
GST_STATE_PAUSED
);
#endif
}
else
{
/* resume */
_gth_slideshow_load_next_image
(
self
);
#if HAVE_GSTREAMER
if
(
self
->
priv
->
playbin
!=
NULL
)
gst_element_set_state
(
self
->
priv
->
playbin
,
GST_STATE_PLAYING
);
#endif
}
}
#if HAVE_GSTREAMER
...
...
@@ -451,41 +383,10 @@ _gth_slideshow_key_press_cb (GthSlideshow *self,
GdkEventKey
*
event
,
gpointer
user_data
)
{
gboolean
handled
=
TRUE
;
switch
(
event
->
keyval
)
{
case
GDK_KEY_F5
:
case
GDK_KEY_Escape
:
case
GDK_KEY_q
:
_gth_slideshow_close
(
self
);
break
;
case
GDK_KEY_p
:
_gth_slideshow_toggle_pause
(
self
);
break
;
case
GDK_KEY_space
:
case
GDK_KEY_Down
:
case
GDK_KEY_Right
:
case
GDK_KEY_Page_Down
:
if
(
self
->
priv
->
paused
)
_gth_slideshow_toggle_pause
(
self
);
else
_gth_slideshow_load_next_image
(
self
);
break
;
case
GDK_KEY_BackSpace
:
case
GDK_KEY_Up
:
case
GDK_KEY_Left
:
case
GDK_KEY_Page_Up
:
_gth_slideshow_load_prev_image
(
self
);
break
;
default:
handled
=
FALSE
;
}
return
handled
;
return
gth_window_activate_shortcut
(
GTH_WINDOW
(
self
),
GTH_SHORTCUT_CONTEXT_SLIDESHOW
,
event
->
keyval
,
event
->
state
);
}
...
...
@@ -537,6 +438,14 @@ _gth_slideshow_construct (GthSlideshow *self,
self
->
priv
->
projector
->
construct
(
self
);
g_action_map_add_action_entries
(
G_ACTION_MAP
(
self
),
actions
,
G_N_ELEMENTS
(
actions
),
self
);
gth_window_copy_shortcuts
(
GTH_WINDOW
(
self
),
GTH_WINDOW
(
self
->
priv
->
browser
),
GTH_SHORTCUT_CONTEXT_SLIDESHOW
);
g_signal_connect
(
self
,
"show"
,
G_CALLBACK
(
gth_slideshow_show_cb
),
self
);
g_signal_connect
(
self
,
...
...
@@ -613,6 +522,98 @@ gth_slideshow_set_random_order (GthSlideshow *self,
}
void
gth_slideshow_toggle_pause
(
GthSlideshow
*
self
)
{
g_return_if_fail
(
GTH_IS_SLIDESHOW
(
self
));
self
->
priv
->
paused
=
!
self
->
priv
->
paused
;
if
(
self
->
priv
->
paused
)
{
self
->
priv
->
projector
->
paused
(
self
);
#if HAVE_GSTREAMER
if
(
self
->
priv
->
playbin
!=
NULL
)
gst_element_set_state
(
self
->
priv
->
playbin
,
GST_STATE_PAUSED
);
#endif
}
else
{
/* resume */
gth_slideshow_load_next_image
(
self
);
#if HAVE_GSTREAMER
if
(
self
->
priv
->
playbin
!=
NULL
)
gst_element_set_state
(
self
->
priv
->
playbin
,
GST_STATE_PLAYING
);
#endif
}
}
void
gth_slideshow_load_next_image
(
GthSlideshow
*
self
)
{
g_return_if_fail
(
GTH_IS_SLIDESHOW
(
self
));
self
->
priv
->
projector
->
load_next_image
(
self
);
self
->
priv
->
direction
=
GTH_SLIDESHOW_DIRECTION_FORWARD
;
if
(
self
->
priv
->
paused
)
return
;
self
->
priv
->
current
=
self
->
priv
->
current
->
next
;
_gth_slideshow_load_current_image
(
self
);
}
void
gth_slideshow_load_prev_image
(
GthSlideshow
*
self
)
{
g_return_if_fail
(
GTH_IS_SLIDESHOW
(
self
));
self
->
priv
->
projector
->
load_prev_image
(
self
);
self
->
priv
->
direction
=
GTH_SLIDESHOW_DIRECTION_BACKWARD
;
if
(
self
->
priv
->
paused
)
return
;
self
->
priv
->
current
=
self
->
priv
->
current
->
prev
;
_gth_slideshow_load_current_image
(
self
);
}
void
gth_slideshow_next_image_or_resume
(
GthSlideshow
*
self
)
{
g_return_if_fail
(
GTH_IS_SLIDESHOW
(
self
));
if
(
self
->
priv
->
paused
)
gth_slideshow_toggle_pause
(
self
);
else
gth_slideshow_load_next_image
(
self
);
}
static
void
_gth_slideshow_close_cb
(
gpointer
user_data
)
{
GthSlideshow
*
self
=
user_data
;
gboolean
close_browser
;
GthBrowser
*
browser
;
browser
=
self
->
priv
->
browser
;
close_browser
=
!
gtk_widget_get_visible
(
GTK_WIDGET
(
browser
));
self
->
priv
->
projector
->
show_cursor
(
self
);
self
->
priv
->
projector
->
finalize
(
self
);
gtk_widget_destroy
(
GTK_WIDGET
(
self
));
if
(
close_browser
)
gth_window_close
(
GTH_WINDOW
(
browser
));
}
void
gth_slideshow_close
(
GthSlideshow
*
self
)
{
call_when_idle
(
_gth_slideshow_close_cb
,
self
);
}
/* -- default projector -- */
...
...
@@ -689,10 +690,10 @@ viewer_event_cb (GtkWidget *widget,
else
if
(
event
->
type
==
GDK_BUTTON_PRESS
)
{
switch
(((
GdkEventButton
*
)
event
)
->
button
)
{
case
1
:
_
gth_slideshow_load_next_image
(
self
);
gth_slideshow_load_next_image
(
self
);
break
;
case
3
:
_
gth_slideshow_load_prev_image
(
self
);
gth_slideshow_load_prev_image
(
self
);
break
;
default:
break
;
...
...
@@ -757,7 +758,7 @@ default_projector_construct (GthSlideshow *self)
gth_image_viewer_set_zoom_change
(
GTH_IMAGE_VIEWER
(
self
->
priv
->
viewer
),
GTH_ZOOM_CHANGE_FIT_SIZE
);
gth_image_viewer_set_zoom_quality
(
GTH_IMAGE_VIEWER
(
self
->
priv
->
viewer
),
GTH_ZOOM_QUALITY_LOW
);
gth_image_viewer_add_painter
(
GTH_IMAGE_VIEWER
(
self
->
priv
->
viewer
),
default_projector_pause_painter
,
self
);
gth_image_viewer_set_transparency_style
(
GTH_IMAGE_VIEWER
(
self
->
priv
->
viewer
),
GTH_TRANSPARENCY_STYLE_
BLACK
);
gth_image_viewer_set_transparency_style
(
GTH_IMAGE_VIEWER
(
self
->
priv
->
viewer
),
GTH_TRANSPARENCY_STYLE_
CHECKERED
);
g_signal_connect
(
self
->
priv
->
viewer
,
"button-press-event"
,
G_CALLBACK
(
viewer_event_cb
),
self
);
g_signal_connect
(
self
->
priv
->
viewer
,
"motion-notify-event"
,
G_CALLBACK
(
viewer_event_cb
),
self
);
...
...
@@ -1065,10 +1066,10 @@ stage_input_cb (ClutterStage *stage,
switch
(
clutter_event_get_button
(
event
))
{
case
1
:
_
gth_slideshow_load_next_image
(
self
);
gth_slideshow_load_next_image
(
self
);
break
;
case
3
:
_
gth_slideshow_load_prev_image
(
self
);
gth_slideshow_load_prev_image
(
self
);
break
;
default:
break
;
...
...
extensions/slideshow/gth-slideshow.h
View file @
701a9f86
...
...
@@ -43,7 +43,7 @@ typedef struct _GthSlideshowPrivate GthSlideshowPrivate;
struct
_GthSlideshow
{
Gt
k
Window
__parent
;
Gt
h
Window
__parent
;
#ifdef HAVE_CLUTTER
ClutterActor
*
stage
;
ClutterActor
*
current_image
;
...
...
@@ -57,7 +57,7 @@ struct _GthSlideshow
struct
_GthSlideshowClass
{
Gt
k
WindowClass
__parent_class
;
Gt
h
WindowClass
__parent_class
;
};
typedef
struct
{
...
...
@@ -93,6 +93,12 @@ void gth_slideshow_set_playlist (GthSlideshow *self,
char
**
files
);
void
gth_slideshow_set_random_order
(
GthSlideshow
*
self
,
gboolean
random
);
void
gth_slideshow_toggle_pause
(
GthSlideshow
*
self
);
void
gth_slideshow_load_next_image
(
GthSlideshow
*
self
);
void
gth_slideshow_load_prev_image
(
GthSlideshow
*
self
);
void
gth_slideshow_next_image_or_resume
(
GthSlideshow
*
self
);
void
gth_slideshow_close
(
GthSlideshow
*
self
);
G_END_DECLS
...
...
extensions/slideshow/main.c
View file @
701a9f86
...
...
@@ -26,6 +26,7 @@
#include "callbacks.h"
#include "gth-transition.h"
#include "preferences.h"
#include "shortcuts.h"
#ifdef HAVE_CLUTTER
...
...
@@ -281,6 +282,11 @@ cube_from_bottom_transition (GthSlideshow *self,
#endif
/* HAVE_CLUTTER */
static
GthShortcutCategory
shortcut_categories
[]
=
{
{
GTH_SHORTCUT_CATEGORY_SLIDESHOW
,
N_
(
"Presentation"
),
40
},
};
G_MODULE_EXPORT
void
gthumb_extension_activate
(
void
)
{
...
...
@@ -341,6 +347,7 @@ gthumb_extension_activate (void)
NULL
);
#endif
/* HAVE_CLUTTER */
gth_main_register_shortcut_category
(
shortcut_categories
,
G_N_ELEMENTS
(
shortcut_categories
));
gth_hook_add_callback
(
"slideshow"
,
10
,
G_CALLBACK
(
ss__slideshow_cb
),
NULL
);
gth_hook_add_callback
(
"gth-browser-construct"
,
10
,
G_CALLBACK
(
ss__gth_browser_construct_cb
),
NULL
);
gth_hook_add_callback
(
"gth-browser-update-sensitivity"
,
10
,
G_CALLBACK
(
ss__gth_browser_update_sensitivity_cb
),
NULL
);
...
...
extensions/slideshow/shortcuts.h
0 → 100644
View file @
701a9f86
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* GThumb
*
* Copyright (C) 2019 Free Software Foundation, Inc.
*
* 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef SLIDESHOW_SHORTCUTS_H
#define SLIDESHOW_SHORTCUTS_H
#define GTH_SHORTCUT_CATEGORY_SLIDESHOW "slideshow"
#endif
/* SLIDESHOW_SHORTCUTS_H */
gthumb/gth-main-default-types.c
View file @
701a9f86
...
...
@@ -40,7 +40,6 @@ static GthShortcutCategory shortcut_categories[] = {
{
GTH_SHORTCUT_CATEGORY_NAVIGATION
,
N_
(
"Navigation"
),
15
},
{
GTH_SHORTCUT_CATEGORY_FILE_MANAGER
,
N_
(
"File Manager"
),
10
},
{
GTH_SHORTCUT_CATEGORY_VIEWER
,
N_
(
"Viewer"
),
20
},
{
GTH_SHORTCUT_CATEGORY_SLIDESHOW
,
N_
(
"Presentation"
),
21
}
};
...
...
gthumb/gth-shortcut.h
View file @
701a9f86
...
...
@@ -32,7 +32,6 @@ G_BEGIN_DECLS
#define GTH_SHORTCUT_CATEGORY_NAVIGATION "file-navigation"
#define GTH_SHORTCUT_CATEGORY_FILE_MANAGER "file-manager"
#define GTH_SHORTCUT_CATEGORY_VIEWER "file-viewer"
#define GTH_SHORTCUT_CATEGORY_SLIDESHOW "slideshow"
typedef
struct
{
...
...
gthumb/gth-shortcuts-window.c
View file @
701a9f86
...
...
@@ -38,7 +38,7 @@ typedef struct {
static
ContextInfo
contexts
[]
=
{
{
GTH_SHORTCUT_CONTEXT_BROWSER
,
"browser"
,
N_
(
"Browser"
)
},
{
GTH_SHORTCUT_CONTEXT_VIEWER
,
"viewer"
,
N_
(
"Viewer"
)
},
//
{ GTH_SHORTCUT_CONTEXT_SLIDESHOW, "slideshow", N_("Presentation") }
{
GTH_SHORTCUT_CONTEXT_SLIDESHOW
,
"slideshow"
,
N_
(
"Presentation"
)
}
};
...
...
gthumb/gth-window.c
View file @
701a9f86
...
...
@@ -745,7 +745,7 @@ gth_window_add_accelerators (GthWindow *window,
NULL
);
shortcut
=
gth_shortcut_new
(
acc
->
action_name
,
NULL
);
shortcut
->
context
=
GTH_SHORTCUT_CONTEXT_INTERNAL
|
GTH_SHORTCUT_CONTEXT_
ANY
;
shortcut
->
context
=
GTH_SHORTCUT_CONTEXT_INTERNAL
|
GTH_SHORTCUT_CONTEXT_
BROWSER_VIEWER
;
shortcut
->
category
=
GTH_SHORTCUT_CATEGORY_HIDDEN
;
gth_shortcut_set_accelerator
(
shortcut
,
acc
->
accelerator
);
_gth_window_add_shortcut
(
window
,
shortcut
);
...
...
@@ -1062,3 +1062,23 @@ gth_window_can_change_shortcut (GthWindow *window,
return
TRUE
;
}
void
gth_window_copy_shortcuts
(
GthWindow
*
to_window
,
GthWindow
*
from_window
,
int
context
)
{
int
i
;
for
(
i
=
0
;
i
<
from_window
->
priv
->
shortcuts_v
->
len
;
i
++
)
{
const
GthShortcut
*
shortcut
=
g_ptr_array_index
(
from_window
->
priv
->
shortcuts_v
,
i
);
GthShortcut
*
new_shortcut
;
if
((
shortcut
->
context
&
context
)
==
0
)
continue
;
new_shortcut
=
gth_shortcut_dup
(
shortcut
);
_gth_window_add_shortcut
(
to_window
,
new_shortcut
);
}
}
gthumb/gth-window.h
View file @
701a9f86
...
...
@@ -146,6 +146,9 @@ gboolean gth_window_can_change_shortcut (GthWindow *window,
guint
keycode
,
GdkModifierType
modifiers
,
GtkWindow
*
parent
);
void
gth_window_copy_shortcuts
(
GthWindow
*
to_window
,
GthWindow
*
from_window
,
int
context
);
G_END_DECLS
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment