[gnome-contacts] Use the conventional path for resources.
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] Use the conventional path for resources.
- Date: Sun, 24 Dec 2017 14:30:47 +0000 (UTC)
commit c459bb1793189660126da35e8cec640da6bd7034
Author: Niels De Graef <nielsdegraef gmail com>
Date: Sun Dec 24 15:28:24 2017 +0100
Use the conventional path for resources.
This makes Gtk+ automagically set our app menu, and it is more
consistent with other apps. See [automatic resources] in
GtkApplication's documentationfor more info.
[automatic resources]: https://developer.gnome.org/gtk3/stable/GtkApplication.html#automatic-resources
data/contacts.gresource.xml | 4 ++--
data/gtk/menus.ui | 25 +++++++++++++++++++++++++
data/ui/app-menu.ui | 25 -------------------------
po/POTFILES.in | 2 +-
src/contacts-accounts-list.vala | 2 +-
src/contacts-address-map.vala | 2 +-
src/contacts-app.vala | 18 +++++-------------
src/contacts-avatar-dialog.vala | 2 +-
src/contacts-contact-editor.vala | 2 +-
src/contacts-contact-pane.vala | 2 +-
src/contacts-in-app-notification.vala | 2 +-
src/contacts-link-suggestion-grid.vala | 2 +-
src/contacts-list-pane.vala | 2 +-
src/contacts-window.vala | 2 +-
14 files changed, 42 insertions(+), 50 deletions(-)
---
diff --git a/data/contacts.gresource.xml b/data/contacts.gresource.xml
index 34c0230..2cca45b 100644
--- a/data/contacts.gresource.xml
+++ b/data/contacts.gresource.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
- <gresource prefix="/org/gnome/contacts">
+ <gresource prefix="/org/gnome/Contacts">
<file compressed="true">ui/style.css</file>
- <file compressed="true" preprocess="xml-stripblanks">ui/app-menu.ui</file>
+ <file compressed="true" preprocess="xml-stripblanks">gtk/menus.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/contacts-accounts-list.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/contacts-address-map.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/contacts-avatar-dialog.ui</file>
diff --git a/data/gtk/menus.ui b/data/gtk/menus.ui
new file mode 100644
index 0000000..178ea93
--- /dev/null
+++ b/data/gtk/menus.ui
@@ -0,0 +1,25 @@
+<interface>
+ <menu id="app-menu">
+ <section>
+ <item>
+ <attribute name="action">app.change-book</attribute>
+ <attribute name="label" translatable="yes">_Change Address Book…</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="action">app.help</attribute>
+ <attribute name="label" translatable="yes">_Help</attribute>
+ </item>
+ <item>
+ <attribute name="action">app.about</attribute>
+ <attribute name="label" translatable="yes">_About</attribute>
+ </item>
+ <item>
+ <attribute name="action">app.quit</attribute>
+ <attribute name="label" translatable="yes">_Quit</attribute>
+ <attribute name="accel"><Primary>q</attribute>
+ </item>
+ </section>
+ </menu>
+</interface>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 358e781..5ff5e04 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -2,7 +2,7 @@
# Please keep this file sorted alphabetically.
data/org.gnome.Contacts.appdata.xml.in
data/org.gnome.Contacts.desktop.in
-data/ui/app-menu.ui
+data/gtk/menus.ui
data/ui/contacts-accounts-list.ui
data/ui/contacts-avatar-dialog.ui
data/ui/contacts-contact-editor.ui
diff --git a/src/contacts-accounts-list.vala b/src/contacts-accounts-list.vala
index 4cbadf3..0682a86 100644
--- a/src/contacts-accounts-list.vala
+++ b/src/contacts-accounts-list.vala
@@ -18,7 +18,7 @@
using Gtk;
using Folks;
-[GtkTemplate (ui = "/org/gnome/contacts/ui/contacts-accounts-list.ui")]
+[GtkTemplate (ui = "/org/gnome/Contacts/ui/contacts-accounts-list.ui")]
public class Contacts.AccountsList : Box {
[GtkChild]
private ListBox accounts_view;
diff --git a/src/contacts-address-map.vala b/src/contacts-address-map.vala
index f03ade1..127e138 100644
--- a/src/contacts-address-map.vala
+++ b/src/contacts-address-map.vala
@@ -24,7 +24,7 @@ using Geocode;
using Gtk;
using GtkClutter;
-[GtkTemplate (ui = "/org/gnome/contacts/ui/contacts-address-map.ui")]
+[GtkTemplate (ui = "/org/gnome/Contacts/ui/contacts-address-map.ui")]
public class Contacts.AddressMap : Frame {
[GtkChild]
diff --git a/src/contacts-app.vala b/src/contacts-app.vala
index c297160..4a0a4c8 100644
--- a/src/contacts-app.vala
+++ b/src/contacts-app.vala
@@ -168,19 +168,11 @@ public class Contacts.App : Gtk.Application {
}
}
- private void create_app_menu () {
+ private void create_actions () {
this.add_action_entries (action_entries, this);
this.set_accels_for_action ("app.help", {"F1"});
this.set_accels_for_action ("app.new-contact", {"<Primary>n"});
-
- var builder = new Gtk.Builder ();
- try {
- builder.add_from_resource ("/org/gnome/contacts/ui/app-menu.ui");
- } catch (GLib.Error e) {
- error ("Error loading app menu: %s", e.message);
- }
- set_app_menu ((MenuModel)builder.get_object ("app-menu"));
}
private void create_window () {
@@ -196,7 +188,7 @@ public class Contacts.App : Gtk.Application {
contacts_store.disconnect (id);
Source.remove (id2);
- create_app_menu ();
+ create_actions ();
create_window ();
window.show ();
@@ -208,7 +200,7 @@ public class Contacts.App : Gtk.Application {
id2 = Timeout.add (500, () => {
contacts_store.disconnect (id);
- create_app_menu ();
+ create_actions ();
create_window ();
window.show ();
@@ -257,7 +249,7 @@ public class Contacts.App : Gtk.Application {
public void load_styling () {
var provider = new Gtk.CssProvider ();
- provider.load_from_resource ("/org/gnome/contacts/ui/style.css");
+ provider.load_from_resource ("/org/gnome/Contacts/ui/style.css");
StyleContext.add_provider_for_screen (Gdk.Screen.get_default(),
provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
@@ -273,7 +265,7 @@ public class Contacts.App : Gtk.Application {
}
}
- create_app_menu ();
+ create_actions ();
create_window ();
window.show ();
}
diff --git a/src/contacts-avatar-dialog.vala b/src/contacts-avatar-dialog.vala
index ee178ca..58f3010 100644
--- a/src/contacts-avatar-dialog.vala
+++ b/src/contacts-avatar-dialog.vala
@@ -26,7 +26,7 @@ using Folks;
*
* After a user has initially chosen an avatar, we provide a cropping tool.
*/
-[GtkTemplate (ui = "/org/gnome/contacts/ui/contacts-avatar-dialog.ui")]
+[GtkTemplate (ui = "/org/gnome/Contacts/ui/contacts-avatar-dialog.ui")]
public class Contacts.AvatarDialog : Dialog {
const int MAIN_SIZE = 128;
const int ICONS_SIZE = 64;
diff --git a/src/contacts-contact-editor.vala b/src/contacts-contact-editor.vala
index 1540db8..b94dba5 100644
--- a/src/contacts-contact-editor.vala
+++ b/src/contacts-contact-editor.vala
@@ -61,7 +61,7 @@ public class Contacts.AddressEditor : Box {
}
}
-[GtkTemplate (ui = "/org/gnome/contacts/ui/contacts-contact-editor.ui")]
+[GtkTemplate (ui = "/org/gnome/Contacts/ui/contacts-contact-editor.ui")]
public class Contacts.ContactEditor : Grid {
private const string[] DEFAULT_PROPS_NEW_CONTACT = {
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala
index ecd13e1..d665a5a 100644
--- a/src/contacts-contact-pane.vala
+++ b/src/contacts-contact-pane.vala
@@ -26,7 +26,7 @@ const int PROFILE_SIZE = 96;
* a page if nothing is selected, a ContactSheet to view contact information,
* and a ContactEditor to edit contact information.
*/
-[GtkTemplate (ui = "/org/gnome/contacts/ui/contacts-contact-pane.ui")]
+[GtkTemplate (ui = "/org/gnome/Contacts/ui/contacts-contact-pane.ui")]
public class Contacts.ContactPane : Stack {
private Window parent_window;
diff --git a/src/contacts-in-app-notification.vala b/src/contacts-in-app-notification.vala
index b3f9aea..a41ad00 100644
--- a/src/contacts-in-app-notification.vala
+++ b/src/contacts-in-app-notification.vala
@@ -17,7 +17,7 @@
using Gtk;
-[GtkTemplate (ui = "/org/gnome/contacts/ui/contacts-in-app-notification.ui")]
+[GtkTemplate (ui = "/org/gnome/Contacts/ui/contacts-in-app-notification.ui")]
public class Contacts.InAppNotification : Revealer {
// Close the in-app notification after 5 seconds by default.
private const uint DEFAULT_KEEPALIVE = 5;
diff --git a/src/contacts-link-suggestion-grid.vala b/src/contacts-link-suggestion-grid.vala
index b3e409e..1546168 100644
--- a/src/contacts-link-suggestion-grid.vala
+++ b/src/contacts-link-suggestion-grid.vala
@@ -24,7 +24,7 @@ using Gee;
* It offers the user the sugugestion of linking the currently shown contact
* and another (hopefully) similar contact.
*/
-[GtkTemplate (ui = "/org/gnome/contacts/ui/contacts-link-suggestion-grid.ui")]
+[GtkTemplate (ui = "/org/gnome/Contacts/ui/contacts-link-suggestion-grid.ui")]
public class Contacts.LinkSuggestionGrid : Grid {
[GtkChild]
diff --git a/src/contacts-list-pane.vala b/src/contacts-list-pane.vala
index ec77f0b..e85d74d 100644
--- a/src/contacts-list-pane.vala
+++ b/src/contacts-list-pane.vala
@@ -20,7 +20,7 @@ using Gee;
using Gtk;
using Folks;
-[GtkTemplate (ui = "/org/gnome/contacts/ui/contacts-list-pane.ui")]
+[GtkTemplate (ui = "/org/gnome/Contacts/ui/contacts-list-pane.ui")]
public class Contacts.ListPane : Frame {
private Store store;
diff --git a/src/contacts-window.vala b/src/contacts-window.vala
index 9d103e6..e961384 100644
--- a/src/contacts-window.vala
+++ b/src/contacts-window.vala
@@ -19,7 +19,7 @@ using Gee;
using Gtk;
using Folks;
-[GtkTemplate (ui = "/org/gnome/contacts/ui/contacts-window.ui")]
+[GtkTemplate (ui = "/org/gnome/Contacts/ui/contacts-window.ui")]
public class Contacts.Window : Gtk.ApplicationWindow {
[GtkChild]
private Grid content_grid;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]