Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 159958 Details for
Bug 240385
add /etc/xdg directories
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
a patch
nonexisting.patch (text/plain), 6.97 KB, created by
Matthias Clasen
on 2007-07-25 16:42:55 UTC
(
hide
)
Description:
a patch
Filename:
MIME Type:
Creator:
Matthias Clasen
Created:
2007-07-25 16:42:55 UTC
Size:
6.97 KB
patch
obsolete
>diff -up gnome-menus-2.19.5/libmenu/menu-monitor.h.nonexisting gnome-menus-2.19.5/libmenu/menu-monitor.h >--- gnome-menus-2.19.5/libmenu/menu-monitor.h.nonexisting 2007-07-08 16:25:09.000000000 -0400 >+++ gnome-menus-2.19.5/libmenu/menu-monitor.h 2007-07-25 03:00:19.000000000 -0400 >@@ -31,7 +31,8 @@ typedef enum > MENU_MONITOR_EVENT_INVALID = 0, > MENU_MONITOR_EVENT_CREATED = 1, > MENU_MONITOR_EVENT_DELETED = 2, >- MENU_MONITOR_EVENT_CHANGED = 3 >+ MENU_MONITOR_EVENT_CHANGED = 3, >+ MENU_MONITOR_EVENT_EXISTS = 4 > } MenuMonitorEvent; > > typedef void (*MenuMonitorNotifyFunc) (MenuMonitor *monitor, >diff -up gnome-menus-2.19.5/libmenu/menu-monitor-fam.c.nonexisting gnome-menus-2.19.5/libmenu/menu-monitor-fam.c >--- gnome-menus-2.19.5/libmenu/menu-monitor-fam.c.nonexisting 2007-07-08 16:25:09.000000000 -0400 >+++ gnome-menus-2.19.5/libmenu/menu-monitor-fam.c 2007-07-25 03:03:11.000000000 -0400 >@@ -27,6 +27,13 @@ > #include <fam.h> > #endif > >+#include <sys/types.h> >+#include <sys/stat.h> >+#include <unistd.h> >+#include <errno.h> >+ >+#include <libgen.h> >+ > #include "menu-util.h" > > #ifdef HAVE_FAM >@@ -35,6 +42,11 @@ static gboolean opened_connection > static gboolean failed_to_connect = FALSE; > static guint fam_io_watch = 0; > >+typedef struct { >+ FAMRequest *request; >+ MenuMonitor *existing; >+} MonitorBackendData; >+ > static void > queue_fam_event (MenuMonitor *monitor, > FAMEvent *fam_event) >@@ -71,6 +83,10 @@ queue_fam_event (MenuMonitor *monitor, > event = MENU_MONITOR_EVENT_DELETED; > break; > >+ case FAMExists: >+ event = MENU_MONITOR_EVENT_EXISTS; >+ break; >+ > default: > g_assert_not_reached (); > break; >@@ -185,9 +201,11 @@ get_fam_connection (void) > { > GIOChannel *io_channel; > >+#if 0 > #ifdef HAVE_FAMNOEXISTS > FAMNoExists (&fam_connection); > #endif /* HAVE_FAMNOEXISTS */ >+#endif > > io_channel = g_io_channel_unix_new (FAMCONNECTION_GETFD (&fam_connection)); > fam_io_watch = g_io_add_watch (io_channel, >@@ -210,12 +228,88 @@ get_fam_connection (void) > } > #endif /* HAVE_FAM */ > >+static char * >+find_existing_prefix (const char *path) >+{ >+ char *existing; >+ struct stat buf; >+ >+ errno = 0; >+ stat (path, &buf); >+ g_print ("stating %s: %d\n", path, errno); >+ if (errno != ENOENT) >+ return NULL; >+ existing = g_strdup (path); >+ do >+ { >+ existing = dirname (existing); >+ errno = 0; >+ stat (existing, &buf); >+ g_print ("stating %s: %d\n", existing, errno); >+ } >+ while (errno == ENOENT); >+ >+ return existing; >+} >+ >+static void >+existing_func (MenuMonitor *monitor, >+ MenuMonitorEvent event, >+ const char *path, >+ gpointer user_data) >+{ >+ MenuMonitor *orig = user_data; >+ MonitorBackendData *data = menu_monitor_get_backend_data (orig); >+ const char *prefix = menu_monitor_get_path (monitor); >+ const char *orig_path = menu_monitor_get_path (orig); >+ const char *p, *q; >+ char *r; >+ >+ if (event != MENU_MONITOR_EVENT_CREATED && >+ event != MENU_MONITOR_EVENT_EXISTS) >+ return; >+ >+ p = path + strlen (prefix); >+ if (*p == G_DIR_SEPARATOR) >+ p++; >+ >+ q = orig_path + strlen (prefix); >+ if (*q == G_DIR_SEPARATOR) >+ q++; >+ >+ r = strchr (q, G_DIR_SEPARATOR); >+ if (r) >+ *r = 0; >+ >+ if (strcmp (p, q) == 0) >+ { >+ menu_verbose ("Unreffing internal directory monitor on '%s' for '%s'\n", >+ prefix, orig_path); >+ menu_monitor_remove_notify (monitor, existing_func, orig); >+ menu_monitor_unref (monitor); >+ data->existing = NULL; >+ >+ if (r) >+ { >+ *r = G_DIR_SEPARATOR; >+ >+ menu_verbose ("Adding internal directory monitor on '%s' for '%s'\n", >+ path, orig_path); >+ data->existing = menu_get_directory_monitor (path); >+ menu_monitor_add_notify (data->existing, existing_func, orig); >+ } >+ else >+ connect_fam_monitor (orig); >+ } >+} >+ > void >-menu_monitor_backend_register_monitor (MenuMonitor *monitor) >+connect_fam_monitor (MenuMonitor *monitor) > { > #ifdef HAVE_FAM > FAMConnection *fam_connection; >- FAMRequest *request; >+ MonitorBackendData *data; >+ const char *path; > > if ((fam_connection = get_fam_connection ()) == NULL) > { >@@ -237,56 +331,84 @@ menu_monitor_backend_register_monitor (M > return; > } > >- request = g_new0 (FAMRequest, 1); >+ data = menu_monitor_get_backend_data (monitor); >+ path = menu_monitor_get_path (monitor); > > if (menu_monitor_get_is_directory (monitor)) > { >+ menu_verbose ("Setting directory monitor on '%s'\n", path); > if (FAMMonitorDirectory (fam_connection, >- menu_monitor_get_path (monitor), >- request, >+ path, >+ data->request, > monitor) != 0) > { > g_warning ("Failed to add directory monitor on '%s': %s", >- menu_monitor_get_path (monitor), >- FamErrlist[FAMErrno]); >- g_free (request); >- request = NULL; >+ path, FamErrlist[FAMErrno]); >+ g_free (data->request); >+ g_free (data); >+ data = NULL; > } > } > else > { >+ menu_verbose ("Setting file monitor on '%s'\n", path); > if (FAMMonitorFile (fam_connection, >- menu_monitor_get_path (monitor), >- request, >+ path, >+ data->request, > monitor) != 0) > { > g_warning ("Failed to add file monitor on '%s': %s", >- menu_monitor_get_path (monitor), >- FamErrlist[FAMErrno]); >- g_free (request); >- request = NULL; >+ path, FamErrlist[FAMErrno]); >+ g_free (data->request); >+ g_free (data); >+ data = NULL; > } > } > >- menu_monitor_set_backend_data (monitor, request); >- > #endif /* HAVE_FAM */ > } > >+void >+menu_monitor_backend_register_monitor (MenuMonitor *monitor) >+{ >+ MonitorBackendData *data; >+ const char *path, *existing; >+ >+ path = menu_monitor_get_path (monitor); >+ existing = find_existing_prefix (path); >+ >+ data = g_new0 (MonitorBackendData, 1); >+ data->request = g_new0 (FAMRequest, 1); >+ menu_monitor_set_backend_data (monitor, data); >+ >+ if (existing) >+ { >+ menu_verbose ("Adding internal directory monitor on '%s' for '%s'\n", >+ existing, path); >+ data->existing = menu_get_directory_monitor (existing); >+ menu_monitor_add_notify (data->existing, existing_func, monitor); >+ } >+ else >+ connect_fam_monitor (monitor); >+} >+ > void > menu_monitor_backend_unregister_monitor (MenuMonitor *monitor) > { > #ifdef HAVE_FAM >- FAMRequest *request; >+ MonitorBackendData *data; > > if (failed_to_connect) > return; > >- if ((request = menu_monitor_get_backend_data (monitor)) != NULL) >+ if ((data = menu_monitor_get_backend_data (monitor)) != NULL) > { >- FAMCancelMonitor (&fam_connection, request); >- g_free (request); >- request = NULL; >+ FAMCancelMonitor (&fam_connection, data->request); >+ if (data->existing) >+ menu_monitor_unref (data->existing); >+ g_free (data->request); >+ g_free (data); >+ data = NULL; > } > > /* Need to process any remaining events for this monitor
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 240385
: 159958