[RFC] Add g_set_application_launcher() to GLib



Hi all.

In oder to decrease API complexity in the RecentManager code, I've
submitted bug #314428 [1], which adds these two new functions:

G_CONST_RETURN gchar *
g_get_application_launcher (void);

void
g_set_application_launcher (const gchar *application_launcher);

This pair of functions will store and retrieve the desktop entry file
name, in order to be indirectely accessed just like the
g_set_application_name() and g_get_application_name() pair.

Rationale: the RecentManager storage specification needs the name and
the command line of the application that is registering a new recently
used resource into the list; since we already store this data inside the
desktop entry file for an application, it should be possible to retrieve
that meta-data from that file, or to directely store the application's
desktop entry filename inside the storage format, like this:

<applications>
  <application launcher="gedit.desktop"
               timestamp="..."
               count="..." />
</applications>

These new functions would allow the RecentManager just to ask a URI of a
resource, instead of a URI *and* a structure:

/* current situation */
struct _EggRecentData
{
  ...
  const gchar *app_name;
  const gchar *app_exec;
};

gboolean
egg_recent_manager_add_item (EggRecentManager  *manager,
			     const gchar       *uri,
                             EggRecentData     *data,
                             GError           **error);

/* with g_set/get_application_launcher() */
gboolean
egg_recent_manager_add_item (EggRecentManager  *manager,
                             const gchar       *uri,
                             GError           **error);

{For those wondering: the other meta-data of the recently used resources
would be set using a egg_recent_manager_add_item_full() function, but
since the other meta-data is not mandatory and can be retrieved from the
resource itself, a simplier API should be enough}

Any comments/thoughts/flames?

Kind regards,
 Emmanuele.

[1] http://bugzilla.gnome.org/show_bug.cgi?id=314428

-- 
Emmanuele Bassi, ebassi gmail com 	|
Log: http://log.emmanuelebassi.net 	|




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]