Commit graph

355 commits

Author SHA1 Message Date
Robert Ancell
9418093900 background: Replace g_object_new with gtk widget methods
This improves compile time type checking.
2020-10-19 04:07:53 +00:00
Adrien Plazas
f06379e30c Replace HdyColumn by HdyClamp
In libhandy 1, HdyClamp replaces HdyColumn. This stops setting values
when they match HdyClamp's defaults.
2020-07-20 08:04:28 +02:00
Robert Ancell
3eb0aaec28 background: Connect signals with g_signal_connect_object in swapped form 2020-03-30 16:18:49 +13:00
Robert Ancell
e9ca51789c background: Replace GtkStack child names with widget references
The child names are easier to break if widgets are changed - this can't be
detected by the compiler.
2020-03-30 02:05:38 +00:00
Robert Ancell
7e0a66226b background: Use GTK widget types 2020-03-30 02:05:38 +00:00
Robert Ancell
2f57847381 background: Remove unused variables 2020-03-30 02:05:38 +00:00
Robert Ancell
4b0d47eaa4 background: Connect signals in swapped form 2020-03-30 02:05:38 +00:00
Felipe Borges
40c8426f15 background: Allow adding multiple files to backgrounds
Fixes #889
2020-03-29 22:38:55 +00:00
Felipe Borges
3785d79ccf background: Don't warn for invalid xml tags
g_warning () is for environment errors. Additional tags than the
ones we require are not necessarily an error.

This behavior causes g-c-c to spam the journal with entries such
as:

Unknown Tag in /usr/share/gnome-background-properties/fedora-workstation-backgrounds.xml: license
Unknown Tag in /usr/share/gnome-background-properties/fedora-workstation-backgrounds.xml: email
Unknown Tag in /usr/share/gnome-background-properties/fedora-workstation-backgrounds.xml: author

Where "license", "email", and "author" are valid tags that we just
don't use.
2020-02-21 13:47:42 +01:00
Tobias Bernard
27b88c2ce6 Background: change thumbnail size to 154 2020-02-19 10:59:28 +00:00
Julian Sparber
2e1dc3da00 background: add remove button overlay to recent section 2020-02-19 09:37:26 +00:00
Florian Müllner
33c23eaef6 background: Remove lock-screen preview
Without different lock-screen settings, there's little reason to
keep showing a lock-screen preview. So rather than updating the
preview to a blurred version of the regular background, just remove
it altogether.

https://gitlab.gnome.org/GNOME/gnome-control-center/issues/864
2020-02-19 09:37:26 +00:00
Florian Müllner
7c436727a3 background: Simplify background-chosen signal
Now that there's only a single background to set, there's no use for
a flag parameter to specify the background(s).

https://gitlab.gnome.org/GNOME/gnome-control-center/issues/864
2020-02-19 09:37:26 +00:00
Julian Sparber
159c9afe93 background: Remove the popover
In 3.36, we will use a heavily blurred wallpaper on the lock screen.

As that wallpaper will be unrecognizable, there is no good reason to
pick a different one from the regular session. The shell will therefore
stop using the separate lock-screen settings.
The popover isn't needed anymore because it would only have one option:
to set the wallpaper. And an additional option for the recent section to
remove the wallpaper for the list, which can be done via a overlay
button.

https://gitlab.gnome.org/GNOME/gnome-control-center/issues/864
2020-02-19 09:37:26 +00:00
Florian Müllner
4838ce4228 background: Remove some dead code
update_preview() is never called with a non-NULL item.

https://gitlab.gnome.org/GNOME/gnome-control-center/issues/864
2020-02-19 09:37:26 +00:00
Robert Ancell
0aad22079f background: Remove unused GCancellable 2020-02-03 09:35:15 +13:00
Robert Ancell
baed38e31c background: Fix CI build breaking on gnome-desktop API change
The change was added in feeee1c. For now we will handle the old and the new API
until this can be built.
2020-01-22 12:01:22 +13:00
Robert Ancell
70f8f74765 background: Move gnome-desktop-thumbnail.h includes
Remove one that wasn't needed, add in two in files that don't include it.
2020-01-22 11:40:42 +13:00
Robert Ancell
179eac628c background: Remove unused include 2020-01-22 11:40:39 +13:00
Javier Jardón
feeee1c744 Adapt to new gnome-desktop API changes 2020-01-16 13:55:40 +00:00
Robert Ancell
b32eab65a6 background: Replace ifdefs with #pragma once 2019-11-27 21:56:10 +00:00
Robert Ancell
cd377768f5 Avoid warnings where G_LOG_DOMAIN is overriden
Undefine the value before overriding it to avoid the following warnings:
../panels/background/cc-background-chooser.c:22: warning: "G_LOG_DOMAIN" redefined
2019-11-04 22:12:05 +00:00
Robert Ancell
ff342dfbc7 background: Use g_autoptr to remove an explicit unref 2019-10-30 12:10:29 +00:00
Robert Ancell
5183faea04 background: Fix crash if a BgRecentSource is unreffed during an async operation
The BG_RECENT_SOURCE (user_data) call was done before it was checked if is was
cancelled. At this point user_data is pointing to an object that has been deleted.

Fixes #729
2019-10-22 14:03:14 +00:00
Niels De Graef
f83450cebf Chain up to parent finalize()
This was forgotten in a few places, which means you have a memory leak
(albeit tiny).
2019-10-14 09:56:08 +02:00
Philip Chimento
ecd27846f8 background: Update clock in both preview modes
There is a clock widget both on the desktop preview and the lock screen.
Without this change, the clock on the desktop preview is always blank.
2019-09-30 11:08:13 -07:00
Damián Nohales
70fb75eb27 background: Allow load background file relative to XML file 2019-09-17 13:35:09 -07:00
Robert Ancell
97985a664e Remove unused GNOMELOCALEDIR defines 2019-09-09 21:45:53 +00:00
Allan Day
4bfb32a578 background: clarify remove background button
The button doesn't delete the original file - it just removes
the image from the selection. "Remove" is therefore a better word
than "Delete", and the destructive action style isn't appropriate.

Fixes #578
2019-07-22 21:25:29 +00:00
Mohammed Sadiq
e1cd43cb48 background: Get Preview aspect ratio from primary monitor
Get the aspect ratio from Primary monitor, and allow the preview
to have smaller size, so that it works well on smaller screens
2019-07-20 02:22:03 +00:00
Georges Basile Stavracas Neto
8d9ed8c655
background: Cleanup BgColorsSource
After commit c64ab472b6, none of the thumbnail factories are
actually used anymore in BgColorsSource. Clean them up from
the code -- which is unused now, but will be kept for future
proofing purposes.
2019-05-30 20:09:54 -03:00
Georges Basile Stavracas Neto
6df2b0bb4a
background: Remove dead code
We do not download pictures anymore; the BgRecentSource
always copies the wallpapers before actually adding them,
and the BgWallpapersSource handles system-wide wallpapers,
which typically do not change.

Remove this dead code, and the unecessary widgets that were
kept to keep this code working -- essentially, a few boxes
around the previewers.
2019-05-30 20:09:53 -03:00
Georges Basile Stavracas Neto
728d3b4fca
background: Add "Open Picture…" header button
This makes the new Background panel feature-complete; we can
add and remove custom wallpapers now.
2019-05-30 20:09:53 -03:00
Georges Basile Stavracas Neto
6c5270db32
background: Add recent backgrounds
Add a recent section, composed by an additional GtkFlowBox and
a separator, and code to hide it when there are no recent
wallpapers.

To the popover menu, add a new "Remove Background" button that
is only visible when clicking on recent backgrounds.
2019-05-30 20:09:53 -03:00
Georges Basile Stavracas Neto
9e39748d16
background: Introduce BgRecentSource
BgRecentSource is a background source implementation that
keeps track of recently added backgrounds.

The backgrounds are copied to $(local data dir)/backgrounds,
which is monitored. When copying files to this folder, the
current time is added as prefix to avoid filename collisions.
2019-05-30 20:09:50 -03:00
Georges Basile Stavracas Neto
5ba721b581
background: Use widgets to render slideshow emblem
Instead of manually rendering it.
2019-05-30 20:01:49 -03:00
Georges Basile Stavracas Neto
5b214404a1
background: Move preview to CcBackgroundPreview
This is a dedicate class to generate the preview. Not only
it renders the pixbuf of the wallpaper, but it also adds
lock screen or desktop frames on top of it. It also monitors
the time to keep the lock screen preview label always updated.
2019-05-30 20:01:48 -03:00
Georges Basile Stavracas Neto
205bfb9446
background: Use the cairo_t provided by GTK
Instead of creating our own one using a deprecated function.
2019-05-30 20:01:48 -03:00
Georges Basile Stavracas Neto
214f03750b
background: Remove CcBackgroundChooserDialog
It's functionality moved to CcBackgroundChooser.
2019-05-30 20:01:48 -03:00
Georges Basile Stavracas Neto
c64ab472b6
background: Switch to GtkFlowBox
This is a major rework on how images are loaded and stored.
Unfortunately, this is so entangled that doing each change
as an atomic step is pretty much unfeasible.

The first major change is that BgSource now returns a GListStore
instead of a GtkListStore. This is necessary for us to bind it
to GtkFlowBox, and pretty much signals we're not using any of
the tree/icon views anymore.

Second, the thumbnail factory was moved to BgSource itself. We
only create factories for large thumbnails, so it's not needed
to handle each one of them individually.

At last, switch CcBackgroundChooser to GtkFlowBox, and adjust
the signals we connect to.
2019-05-30 20:01:45 -03:00
Georges Basile Stavracas Neto
ee37d0194c
background: Cache thumbnails in CcBackgroundItem
We don't actually need to use custom qdata in GObjects to do
that; instead, cache the thumbnail directly in the item.
2019-05-30 20:01:12 -03:00
Georges Basile Stavracas Neto
df80d4a2fe
background-panel: Remove background chooser buttons
The chooser itself is now located below, and we don't need
to have the buttons anymore.
2019-05-30 20:01:12 -03:00
Georges Basile Stavracas Neto
2f032f224a
background: Introduce CcBackgroundChooser
It will become essentially what CcBackgroundChooserDialog,
but without a dialog and organized differently. Right now,
it is as minimal as it could be and only shows wallpapers.
As we grow it, it may cover pictures and even colors.
2019-05-30 20:01:12 -03:00
Georges Basile Stavracas Neto
5afc292c2b
background: Make BgSource receive a GtkWidget
Instead of a GtkWindow. We don't really depend on GtkWindow
itself, just any widget with access to the scale factor.
2019-05-30 20:01:12 -03:00
Georges Basile Stavracas Neto
ad740deeea
background: Turn into a template class 2019-05-30 20:01:11 -03:00
Georges Basile Stavracas Neto
c290dadf0c
background: Rename ui file to cc-background-panel.ui 2019-05-30 20:01:11 -03:00
Robert Ancell
2b95f9576d background: Fix compile warnings with g_clear_pointer 2019-02-07 11:22:53 +13:00
Robert Ancell
c11890667b background: Fix warning when XDG_PICTURES_DIR not defined
Make the code match the existing monitor to fall back to the home directory.

The error message was:
(gnome-control-center:22910): GLib-GIO-CRITICAL **: 16:42:17.915: g_file_new_for_path: assertion 'path != NULL' failed
2018-10-18 01:31:27 +00:00
Robert Ancell
9da8e1b68d background: Fix warning when opening background selection dialog
This was due to the callback occurring before all the widgets had been added to
the dialog.

Also remove the workaround for the handler occuring during/after dispose by
using g_signal_connect_object.

The warnings were:
(gnome-control-center:13048): Gtk-CRITICAL **: 09:42:17.841: gtk_bin_get_child: assertion 'GTK_IS_BIN (bin)' failed
(gnome-control-center:13048): Gtk-CRITICAL **: 09:42:17.841: gtk_icon_view_unselect_all: assertion 'GTK_IS_ICON_VIEW (icon_view)' failed
2018-10-10 22:57:43 +00:00
Robert Ancell
d2d8a501cd background: Don't use gtk_widget_show_all
It is removed in GTK+ 4
2018-10-10 04:01:11 +00:00