[shotwell/wip/dedeprecate: 36/38] WIP
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [shotwell/wip/dedeprecate: 36/38] WIP
- Date: Wed, 2 Nov 2016 19:59:36 +0000 (UTC)
commit 4584213b504a2de311f5dd546dac2ee53d9c90c7
Author: Jens Georg <mail jensge org>
Date: Tue Nov 1 21:06:20 2016 +0100
WIP
src/AppWindow.vala | 107 ++++++++++------------------------------
src/Page.vala | 2 -
src/library/LibraryWindow.vala | 10 +++-
ui/direct.ui | 2 +-
ui/events_directory.ui | 2 +-
ui/import.ui | 2 +-
ui/import_queue.ui | 2 +-
ui/media.ui | 2 +-
ui/offline.ui | 2 +-
ui/photo.ui | 2 +-
ui/trash.ui | 2 +-
11 files changed, 42 insertions(+), 93 deletions(-)
---
diff --git a/src/AppWindow.vala b/src/AppWindow.vala
index 19894e8..5b2d844 100644
--- a/src/AppWindow.vala
+++ b/src/AppWindow.vala
@@ -22,6 +22,8 @@ public class FullscreenWindow : PageWindow {
public FullscreenWindow(Page page) {
set_current_page(page);
+#if 0
+ FIXME: Leave fullscren accellerator
File ui_file = Resources.get_ui("fullscreen.ui");
try {
@@ -38,7 +40,7 @@ public class FullscreenWindow : PageWindow {
Gtk.AccelGroup accel_group = ui.get_accel_group();
if (accel_group != null)
add_accel_group(accel_group);
-
+#endif
set_screen(AppWindow.get_instance().get_screen());
// Needed so fullscreen will occur on correct monitor in multi-monitor setups
@@ -130,7 +132,7 @@ public class FullscreenWindow : PageWindow {
return result;
}
-
+#if 0
private Gtk.ActionEntry[] create_actions() {
Gtk.ActionEntry[] actions = new Gtk.ActionEntry[0];
@@ -142,6 +144,7 @@ public class FullscreenWindow : PageWindow {
return actions;
}
+#endif
public override bool key_press_event(Gdk.EventKey event) {
// check for an escape/abort
@@ -289,9 +292,7 @@ public class FullscreenWindow : PageWindow {
// subclass. A subclass should set current_page to the user-visible Page for it to receive
// various notifications. It is the responsibility of the subclass to notify Pages when they're
// switched to and from, and other aspects of the Page interface.
-public abstract class PageWindow : Gtk.Window {
- protected Gtk.UIManager ui = new Gtk.UIManager();
-
+public abstract class PageWindow : Gtk.ApplicationWindow {
private Page current_page = null;
private int busy_counter = 0;
@@ -306,10 +307,6 @@ public abstract class PageWindow : Gtk.Window {
set_has_resize_grip(false);
}
- public Gtk.UIManager get_ui_manager() {
- return ui;
- }
-
public Page? get_current_page() {
return current_page;
}
@@ -422,8 +419,6 @@ public abstract class AppWindow : PageWindow {
protected int pos_x = 0;
protected int pos_y = 0;
- private Gtk.ActionGroup common_action_group = new Gtk.ActionGroup("AppWindowGlobalActionGroup");
-
public AppWindow() {
// although there are multiple AppWindow types, only one may exist per-process
assert(instance == null);
@@ -454,10 +449,11 @@ public abstract class AppWindow : PageWindow {
// UIManager. In order to activate those accelerators, we need to create a dummy UI string
// that lists all the common actions. We build it on-the-fly from the actions associated
// with each ActionGroup while we're adding the groups to the UIManager.
+#if 0
common_action_groups = create_common_action_groups();
foreach (Gtk.ActionGroup group in common_action_groups)
ui.insert_action_group(group, 0);
-
+
try {
ui.add_ui_from_string(build_dummy_ui_string(common_action_groups), -1);
} catch (Error err) {
@@ -466,6 +462,7 @@ public abstract class AppWindow : PageWindow {
ui.ensure_update();
add_accel_group(ui.get_accel_group());
+#endif
Gtk.CssProvider provider = new Gtk.CssProvider();
try {
@@ -475,67 +472,20 @@ public abstract class AppWindow : PageWindow {
debug("Unable to load custom CSS: %s", err.message);
}
}
-
- private Gtk.ActionEntry[] create_common_actions() {
- Gtk.ActionEntry[] actions = new Gtk.ActionEntry[0];
-
- Gtk.ActionEntry quit = { "CommonQuit", Resources.QUIT_LABEL, TRANSLATABLE, "<Ctrl>Q",
- TRANSLATABLE, on_quit };
- quit.label = Resources.QUIT_LABEL;
- actions += quit;
-
- Gtk.ActionEntry about = { "CommonAbout", Resources.ABOUT_LABEL, TRANSLATABLE, null,
- TRANSLATABLE, on_about };
- about.label = Resources.ABOUT_LABEL;
- actions += about;
-
- Gtk.ActionEntry fullscreen = { "CommonFullscreen", Resources.FULLSCREEN_LABEL,
- TRANSLATABLE, "F11", TRANSLATABLE, on_fullscreen };
- fullscreen.label = Resources.FULLSCREEN_LABEL;
- actions += fullscreen;
-
- Gtk.ActionEntry help_contents = { "CommonHelpContents", Resources.HELP_LABEL,
- TRANSLATABLE, "F1", TRANSLATABLE, on_help_contents };
- help_contents.label = _("_Contents");
- actions += help_contents;
-
- Gtk.ActionEntry help_faq = { "CommonHelpFAQ", null, TRANSLATABLE, null,
- TRANSLATABLE, on_help_faq };
- help_faq.label = _("_Frequently Asked Questions");
- actions += help_faq;
-
- Gtk.ActionEntry help_report_problem = { "CommonHelpReportProblem", null, TRANSLATABLE, null,
- TRANSLATABLE, on_help_report_problem };
- help_report_problem.label = _("_Report a Problem…");
- actions += help_report_problem;
-
- Gtk.ActionEntry undo = { "CommonUndo", Resources.UNDO_MENU, TRANSLATABLE, "<Ctrl>Z",
- TRANSLATABLE, on_undo };
- undo.label = Resources.UNDO_MENU;
- actions += undo;
-
- Gtk.ActionEntry redo = { "CommonRedo", Resources.REDO_MENU, TRANSLATABLE, "<Ctrl><Shift>Z",
- TRANSLATABLE, on_redo };
- redo.label = Resources.REDO_MENU;
- actions += redo;
-
- Gtk.ActionEntry jump_to_file = { "CommonJumpToFile", Resources.JUMP_TO_FILE_MENU, TRANSLATABLE,
- "<Ctrl><Shift>M", TRANSLATABLE, on_jump_to_file };
- jump_to_file.label = Resources.JUMP_TO_FILE_MENU;
- actions += jump_to_file;
-
- Gtk.ActionEntry select_all = { "CommonSelectAll", Resources.SELECT_ALL_MENU, TRANSLATABLE,
- "<Ctrl>A", TRANSLATABLE, on_select_all };
- select_all.label = Resources.SELECT_ALL_MENU;
- actions += select_all;
-
- Gtk.ActionEntry select_none = { "CommonSelectNone", null, null,
- "<Ctrl><Shift>A", TRANSLATABLE, on_select_none };
- actions += select_none;
-
- return actions;
- }
-
+
+ private const GLib.ActionEntry[] common_actions = {
+ { "CommonQuit", on_quit },
+ { "CommonFullscreen", on_fullscreen },
+ { "CommonHelpContents", on_help_contents },
+ { "CommonHelpFAQ", on_help_faq },
+ { "CommonHelpReportProblem", on_help_report_problem },
+ { "CommonUndo", on_undo },
+ { "CommonRedo", on_redo },
+ { "CommonJumpToFile", on_jump_to_file },
+ { "CommonSelectAll", on_select_all },
+ { "CommonSelectNone", on_select_none }
+ };
+
protected abstract void on_fullscreen();
public static bool has_instance() {
@@ -747,15 +697,10 @@ public abstract class AppWindow : PageWindow {
sys_show_uri(get_window().get_screen(), url);
}
- protected virtual Gtk.ActionGroup[] create_common_action_groups() {
- Gtk.ActionGroup[] groups = new Gtk.ActionGroup[0];
-
- common_action_group.add_actions(create_common_actions(), this);
- groups += common_action_group;
-
- return groups;
+ protected virtual void add_actions () {
+ this.add_action_entries (AppWindow.common_actions, this);
}
-
+
public Gtk.ActionGroup[] get_common_action_groups() {
return common_action_groups;
}
diff --git a/src/Page.vala b/src/Page.vala
index ed4c385..f7c7a75 100644
--- a/src/Page.vala
+++ b/src/Page.vala
@@ -520,8 +520,6 @@ public abstract class Page : Gtk.ScrolledWindow {
init_load_ui(ui_filename);
//ui.insert_action_group(action_group, 0);
- critical ("==> %p", builder.get_object ("MenuBar") as GLib.Menu);
-
}
public void init_toolbar(string path) {
diff --git a/src/library/LibraryWindow.vala b/src/library/LibraryWindow.vala
index 36c5c93..e87be64 100644
--- a/src/library/LibraryWindow.vala
+++ b/src/library/LibraryWindow.vala
@@ -423,8 +423,9 @@ public class LibraryWindow : AppWindow {
group.add_radio_actions(actions, SORT_EVENTS_ORDER_ASCENDING, on_events_sort_changed);
}
- protected override Gtk.ActionGroup[] create_common_action_groups() {
- Gtk.ActionGroup[] groups = base.create_common_action_groups();
+ protected Gtk.ActionGroup[] create_common_action_groups() {
+ Gtk.ActionGroup[] groups = new Gtk.ActionGroup[0];
+ //base.create_common_action_groups();
common_action_group.add_actions(create_common_actions(), this);
common_action_group.add_toggle_actions(create_common_toggle_actions(), this);
@@ -483,6 +484,8 @@ public class LibraryWindow : AppWindow {
// show_all() may make visible certain items we wish to keep programmatically hidden
public override void show_all() {
base.show_all();
+ if (false != true)
+ return;
Gtk.ToggleAction? basic_properties_action = get_current_page().get_common_action(
"CommonDisplayBasicProperties") as Gtk.ToggleAction;
@@ -1117,6 +1120,9 @@ public class LibraryWindow : AppWindow {
// check for settings that should persist between instances
private void load_configuration() {
+ if (false != true) {
+ return;
+ }
Gtk.ToggleAction? basic_display_action = get_common_action("CommonDisplayBasicProperties")
as Gtk.ToggleAction;
assert(basic_display_action != null);
diff --git a/ui/direct.ui b/ui/direct.ui
index 8db551b..d0bdaf8 100644
--- a/ui/direct.ui
+++ b/ui/direct.ui
@@ -36,7 +36,7 @@
<item>
<attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="accel"><Primary>q</attribute>
- <attribute name="action">CommonQuit</attribute>
+ <attribute name="action">win.CommonQuit</attribute>
</item>
</section>
</submenu>
diff --git a/ui/events_directory.ui b/ui/events_directory.ui
index bf0abca..68ccb91 100644
--- a/ui/events_directory.ui
+++ b/ui/events_directory.ui
@@ -24,7 +24,7 @@
<item>
<attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="accel"><Primary>q</attribute>
- <attribute name="action">CommonQuit</attribute>
+ <attribute name="action">win.CommonQuit</attribute>
</item>
</section>
</submenu>
diff --git a/ui/import.ui b/ui/import.ui
index 5f92d19..fc63675 100644
--- a/ui/import.ui
+++ b/ui/import.ui
@@ -32,7 +32,7 @@
<item>
<attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="accel"><Primary>q</attribute>
- <attribute name="action">CommonQuit</attribute>
+ <attribute name="action">win.CommonQuit</attribute>
</item>
</section>
</submenu>
diff --git a/ui/import_queue.ui b/ui/import_queue.ui
index e8685bc..af093f5 100644
--- a/ui/import_queue.ui
+++ b/ui/import_queue.ui
@@ -30,7 +30,7 @@
<item>
<attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="accel"><Primary>q</attribute>
- <attribute name="action">CommonQuit</attribute>
+ <attribute name="action">win.CommonQuit</attribute>
</item>
</section>
</submenu>
diff --git a/ui/media.ui b/ui/media.ui
index 1afe418..afdb665 100644
--- a/ui/media.ui
+++ b/ui/media.ui
@@ -39,7 +39,7 @@
<item>
<attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="accel"><Primary>q</attribute>
- <attribute name="action">CommonQuit</attribute>
+ <attribute name="action">win.CommonQuit</attribute>
</item>
</section>
</submenu>
diff --git a/ui/offline.ui b/ui/offline.ui
index 54ed0c1..719c37f 100644
--- a/ui/offline.ui
+++ b/ui/offline.ui
@@ -24,7 +24,7 @@
<item>
<attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="accel"><Primary>q</attribute>
- <attribute name="action">CommonQuit</attribute>
+ <attribute name="action">win.CommonQuit</attribute>
</item>
</section>
</submenu>
diff --git a/ui/photo.ui b/ui/photo.ui
index 4d79f93..19b2026 100644
--- a/ui/photo.ui
+++ b/ui/photo.ui
@@ -47,7 +47,7 @@
<item>
<attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="accel"><Primary>q</attribute>
- <attribute name="action">CommonQuit</attribute>
+ <attribute name="action">win.CommonQuit</attribute>
</item>
</section>
</submenu>
diff --git a/ui/trash.ui b/ui/trash.ui
index af83d07..21a2462 100644
--- a/ui/trash.ui
+++ b/ui/trash.ui
@@ -29,7 +29,7 @@
<item>
<attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="accel"><Primary>q</attribute>
- <attribute name="action">CommonQuit</attribute>
+ <attribute name="action">win.CommonQuit</attribute>
</item>
</section>
</submenu>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]