Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] test using upstream's gnome-desktop thumbnailer #2292

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libnemo-private/nemo-thumbnails.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include <sys/wait.h>
#include <unistd.h>
#include <signal.h>
#include <libcinnamon-desktop/gnome-desktop-thumbnail.h>
#include <libgnome-desktop/gnome-desktop-thumbnail.h>

#define DEBUG_FLAG NEMO_DEBUG_THUMBNAILS
#include <libnemo-private/nemo-debug.h>
Expand Down Expand Up @@ -710,5 +710,5 @@ nemo_create_thumbnail (NemoFile *file, gint throttle_count)
gboolean
nemo_thumbnail_factory_check_status (void)
{
return gnome_desktop_thumbnail_cache_check_permissions (get_thumbnail_factory (), TRUE);
// return gnome_desktop_thumbnail_cache_check_permissions (get_thumbnail_factory (), TRUE);
}
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ gobject = dependency('gobject-2.0', version: '>=2.0')
go_intr = dependency('gobject-introspection-1.0', version: '>=1.0')
libnotif= dependency('libnotify', version: '>=0.7.0')

cinnamon= dependency('cinnamon-desktop', version: '>=2.6.1')
cinnamon= dependency('gnome-desktop-3.0', version: '>=3.28.0')
gail = dependency('gail-3.0')
libxml = dependency('libxml-2.0', version: '>=2.7.8')
x11 = dependency('x11')
Expand Down
18 changes: 9 additions & 9 deletions src/nemo-application.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
#include <libnotify/notify.h>

#define GNOME_DESKTOP_USE_UNSTABLE_API
#include <libcinnamon-desktop/gnome-desktop-thumbnail.h>
#include <libgnome-desktop/gnome-desktop-thumbnail.h>

#define NEMO_ACCEL_MAP_SAVE_DELAY 30

Expand Down Expand Up @@ -560,13 +560,13 @@ nemo_application_startup (GApplication *app)
/* silently do a full check of the cache and fix if running as root.
* If running as a normal user, do a quick check, and we'll notify the
* user later if there's a problem via an infobar */
if (geteuid () == 0) {
if (!gnome_desktop_thumbnail_cache_check_permissions (NULL, FALSE))
gnome_desktop_thumbnail_cache_fix_permissions ();
} else {
if (!gnome_desktop_thumbnail_cache_check_permissions (NULL, TRUE))
self->priv->cache_problem = TRUE;
}
// if (geteuid () == 0) {
// if (!gnome_desktop_thumbnail_cache_check_permissions (NULL, FALSE))
// gnome_desktop_thumbnail_cache_fix_permissions ();
// } else {
// if (!gnome_desktop_thumbnail_cache_check_permissions (NULL, TRUE))
// self->priv->cache_problem = TRUE;
// }
}

static void
Expand Down Expand Up @@ -642,7 +642,7 @@ nemo_application_get_singleton (void)
void
nemo_application_check_thumbnail_cache (NemoApplication *application)
{
application->priv->cache_problem = !nemo_thumbnail_factory_check_status ();
application->priv->cache_problem = FALSE; //!nemo_thumbnail_factory_check_status ();
}

gboolean
Expand Down
36 changes: 18 additions & 18 deletions src/nemo-bookmark-list.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
#include <libnemo-private/nemo-file-utilities.h>
#include <libnemo-private/nemo-file.h>
#include <libnemo-private/nemo-icon-names.h>
#define GNOME_DESKTOP_USE_UNSTABLE_API
#include <libcinnamon-desktop/gnome-desktop-utils.h>
// #define GNOME_DESKTOP_USE_UNSTABLE_API
// #include <libgnome-desktop/gnome-desktop-utils.h>

#include <gio/gio.h>
#include <string.h>
Expand Down Expand Up @@ -61,24 +61,24 @@ static void nemo_bookmark_list_save_file (NemoBookmarkList *bookmarks

G_DEFINE_TYPE(NemoBookmarkList, nemo_bookmark_list, G_TYPE_OBJECT);

static void
ensure_proper_file_permissions (GFile *file)
{
if (geteuid () == 0) {
struct passwd *pwent;
pwent = gnome_desktop_get_session_user_pwent ();
// static void
// ensure_proper_file_permissions (GFile *file)
// {
// if (geteuid () == 0) {
// struct passwd *pwent;
// pwent = gnome_desktop_get_session_user_pwent ();

gchar *path = g_file_get_path (file);
// gchar *path = g_file_get_path (file);

if (g_strcmp0 (pwent->pw_dir, g_get_home_dir ()) == 0) {
G_GNUC_UNUSED int res;
// if (g_strcmp0 (pwent->pw_dir, g_get_home_dir ()) == 0) {
// G_GNUC_UNUSED int res;

res = chown (path, pwent->pw_uid, pwent->pw_gid);
}
// res = chown (path, pwent->pw_uid, pwent->pw_gid);
// }

g_free (path);
}
}
// g_free (path);
// }
// }

static NemoBookmark *
new_bookmark_from_uri (const char *uri, const char *label, NemoBookmarkMetadata *md)
Expand Down Expand Up @@ -869,7 +869,7 @@ save_bookmark_metadata_file (NemoBookmarkList *list)
if (g_key_file_save_to_file (kfile,
filename,
&error)) {
ensure_proper_file_permissions (file);
// ensure_proper_file_permissions (file);
} else {
g_warning ("Could not save bookmark metadata file: %s\n", error->message);
g_error_free (error);
Expand Down Expand Up @@ -962,7 +962,7 @@ save_files_thread (GTask *task,
NULL,
NULL,
&error)) {
ensure_proper_file_permissions (file);
// ensure_proper_file_permissions (file);
g_task_return_boolean (task, TRUE);
} else {
g_task_return_error (task, error);
Expand Down
4 changes: 2 additions & 2 deletions src/nemo-main-application.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@

#define GNOME_DESKTOP_USE_UNSTABLE_API

#include <libcinnamon-desktop/gnome-desktop-thumbnail.h>
#include <libgnome-desktop/gnome-desktop-thumbnail.h>

/* Keep window from shrinking down ridiculously small; numbers are somewhat arbitrary */
#define APPLICATION_WINDOW_MIN_WIDTH 300
Expand Down Expand Up @@ -654,7 +654,7 @@ nemo_main_application_local_command_line (GApplication *application,
if (geteuid () != 0) {
g_printerr ("The --fix-cache option must be run with sudo or as the root user.\n");
} else {
gnome_desktop_thumbnail_cache_fix_permissions ();
// gnome_desktop_thumbnail_cache_fix_permissions ();
g_print ("User thumbnail cache successfully repaired.\n");
}

Expand Down
2 changes: 1 addition & 1 deletion src/nemo-properties-window.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include <libxapp/xapp-icon-chooser-dialog.h>

#define GNOME_DESKTOP_USE_UNSTABLE_API
#include <libcinnamon-desktop/gnome-desktop-thumbnail.h>
#include <libgnome-desktop/gnome-desktop-thumbnail.h>

#include <eel/eel-accessibility.h>
#include <eel/eel-glib-extensions.h>
Expand Down