diff --git a/data/com.github.ronnydo.colorpicker.appdata.xml b/data/com.github.ronnydo.colorpicker.appdata.xml index 044f4b7..75b7e2c 100644 --- a/data/com.github.ronnydo.colorpicker.appdata.xml +++ b/data/com.github.ronnydo.colorpicker.appdata.xml @@ -7,11 +7,12 @@ Color Picker The most intuitive Color Picker to speed up your workflow. -

One Color Picker to rule them all! No overhelming menus and settings. Just a dialog with all the features you'll need:

+

One Color Picker to rule them all! No overhelming menus or settings. An easy tool with the features you need.

+

Features:

diff --git a/data/com.github.ronnydo.colorpicker.gschema.xml b/data/com.github.ronnydo.colorpicker.gschema.xml new file mode 100644 index 0000000..23f3440 --- /dev/null +++ b/data/com.github.ronnydo.colorpicker.gschema.xml @@ -0,0 +1,17 @@ + + + + + -1 + Most recent x position of app window + Most recent x position of app window + + + -1 + Most recent y position of app window + Most recent y position of app window + + + diff --git a/data/meson.build b/data/meson.build index e428ee7..c8dd69f 100644 --- a/data/meson.build +++ b/data/meson.build @@ -7,6 +7,11 @@ foreach i : icon_sizes ) endforeach +install_data( + meson.project_name() + '.gschema.xml', + install_dir: join_paths(get_option('datadir'), 'glib-2.0', 'schemas') +) + install_data( meson.project_name() + '.desktop', install_dir: join_paths(get_option('datadir'), 'applications') diff --git a/meson.build b/meson.build index 3bb43c5..848d87b 100644 --- a/meson.build +++ b/meson.build @@ -26,13 +26,15 @@ executable( 'src/Widgets/MousePosition.vala', c_args: c_args, dependencies: [ + dependency('glib-2.0'), + dependency('gobject-2.0'), dependency('granite'), dependency('gtk+-3.0'), ], install : true ) -#meson.add_install_script('meson/post_install.py') +meson.add_install_script('meson/post_install.py') subdir('data') subdir('po') diff --git a/src/ColorPicker.vala b/src/ColorPicker.vala index 8cd7e54..c42578e 100644 --- a/src/ColorPicker.vala +++ b/src/ColorPicker.vala @@ -35,7 +35,7 @@ namespace ColorPicker { } var app_window = new ColorPickerWindow (this); - + app_window.show_all (); var quit_action = new SimpleAction ("quit", null); diff --git a/src/ColorPickerWindow.vala b/src/ColorPickerWindow.vala index 5acdf3b..f6591c0 100644 --- a/src/ColorPickerWindow.vala +++ b/src/ColorPickerWindow.vala @@ -22,7 +22,7 @@ namespace ColorPicker { public class ColorPickerWindow: Gtk.Dialog { - + ExtRGBA ext_active_color = ExtRGBA (); public ColorPickerWindow (Gtk.Application application) { @@ -36,7 +36,8 @@ namespace ColorPicker { } construct { - // main box + // main box + ext_active_color.parse ("#FFFFFF"); var color_area = new ColorArea (); @@ -48,8 +49,7 @@ namespace ColorPicker { hex_label.set_selectable (true); hex_label.set_use_markup (true); - hex_label.get_style_context ().add_class ("h1"); - + hex_label.get_style_context ().add_class ("h1"); var pick_color_button = new Gtk.Button.with_label (_("Pick Color")); pick_color_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); @@ -126,7 +126,16 @@ namespace ColorPicker { var content_box = get_content_area () as Gtk.Box; content_box.pack_start (skeleton_box); - + + + var settings = new Settings ("com.github.ronnydo.colorpicker"); + var window_x = settings.get_int ("window-x"); + var window_y = settings.get_int ("window-y"); + + if (window_x != -1 || window_y != -1) { + move (window_x, window_y); + } + // activate color picker pick_color_button.clicked.connect (() => { var mouse_position = new ColorPicker.Widgets.MousePosition (); @@ -226,6 +235,18 @@ namespace ColorPicker { } } + public override bool delete_event (Gdk.EventAny event) { + // save window position + int root_x, root_y; + get_position (out root_x, out root_y); + + var settings = new Settings ("com.github.ronnydo.colorpicker"); + settings.set_int ("window-x", root_x); + settings.set_int ("window-y", root_y); + + return false; + } + }