Commit f8d3aab0 authored by Jim Krehl's avatar Jim Krehl
Browse files

linked up disable command line gconf key

svn path=/branches/version-2/; revision=188
parent cf7ddd11
......@@ -18,11 +18,14 @@
#define DOCS_BOOKMARK_FILENAME "documents.xbel"
#define DIRS_BOOKMARK_FILENAME "places.xbel"
#define DISABLE_TERMINAL_GCONF_KEY "/desktop/gnome/lockdown/disable_command_line"
#define MODIFIABLE_SYSTEM_GCONF_KEY "/desktop/gnome/applications/main-menu/lock-down/user_modifiable_system_area"
#define MODIFIABLE_APPS_GCONF_KEY "/desktop/gnome/applications/main-menu/lock-down/user_modifiable_apps"
#define MODIFIABLE_DOCS_GCONF_KEY "/desktop/gnome/applications/main-menu/lock-down/user_modifiable_docs"
#define MODIFIABLE_DIRS_GCONF_KEY "/desktop/gnome/applications/main-menu/lock-down/user_modifiable_dirs"
#define DESKTOP_ITEM_TERMINAL_EMULATOR_FLAG "TerminalEmulator"
static gchar *get_data_file_path (const gchar *, gboolean);
static gboolean store_has_uri (const gchar *, const gchar *);
static GList *get_uri_list (const gchar *);
......@@ -813,6 +816,29 @@ libslab_user_docs_store_has_uri (const gchar *uri)
return exists;
}
gboolean
libslab_desktop_item_is_a_terminal (const gchar *uri)
{
GnomeDesktopItem *d_item;
const gchar *categories;
gboolean is_terminal = FALSE;
d_item = libslab_gnome_desktop_item_new_from_unknown_id (uri);
if (! d_item)
return FALSE;
categories = gnome_desktop_item_get_string (d_item, GNOME_DESKTOP_ITEM_CATEGORIES);
is_terminal = (categories && strstr (categories, DESKTOP_ITEM_TERMINAL_EMULATOR_FLAG));
gnome_desktop_item_unref (d_item);
return is_terminal;
}
static gboolean
store_has_uri (const gchar *path, const gchar *uri)
{
......
......@@ -80,6 +80,7 @@ void libslab_set_gconf_value (const gchar *key, gconstpointer data)
guint libslab_gconf_notify_add (const gchar *key, GConfClientNotifyFunc callback, gpointer user_data);
void libslab_gconf_notify_remove (guint conn_id);
void libslab_handle_g_error (GError **error, const gchar *msg_format, ...);
gboolean libslab_desktop_item_is_a_terminal (const gchar *uri);
GList *libslab_get_system_item_uris (void);
GList *libslab_get_user_app_uris (void);
......
......@@ -67,6 +67,7 @@
#define MODIFIABLE_APPS_GCONF_KEY LOCKDOWN_GCONF_DIR "/user_modifiable_apps"
#define MODIFIABLE_DOCS_GCONF_KEY LOCKDOWN_GCONF_DIR "/user_modifiable_docs"
#define MODIFIABLE_DIRS_GCONF_KEY LOCKDOWN_GCONF_DIR "/user_modifiable_dirs"
#define DISABLE_TERMINAL_GCONF_KEY "/desktop/gnome/lockdown/disable_command_line"
G_DEFINE_TYPE (MainMenuUI, main_menu_ui, G_TYPE_OBJECT)
......@@ -117,6 +118,7 @@ typedef struct {
guint modifiable_apps_gconf_mntr_id;
guint modifiable_docs_gconf_mntr_id;
guint modifiable_dirs_gconf_mntr_id;
guint disable_term_gconf_mntr_id;
gboolean ptr_is_grabbed;
gboolean kbd_is_grabbed;
......@@ -353,6 +355,7 @@ main_menu_ui_init (MainMenuUI *this)
priv->modifiable_apps_gconf_mntr_id = 0;
priv->modifiable_docs_gconf_mntr_id = 0;
priv->modifiable_dirs_gconf_mntr_id = 0;
priv->disable_term_gconf_mntr_id = 0;
priv->ptr_is_grabbed = FALSE;
priv->kbd_is_grabbed = FALSE;
......@@ -387,6 +390,7 @@ main_menu_ui_finalize (GObject *g_obj)
libslab_gconf_notify_remove (priv->modifiable_apps_gconf_mntr_id);
libslab_gconf_notify_remove (priv->modifiable_docs_gconf_mntr_id);
libslab_gconf_notify_remove (priv->modifiable_dirs_gconf_mntr_id);
libslab_gconf_notify_remove (priv->disable_term_gconf_mntr_id);
G_OBJECT_CLASS (main_menu_ui_parent_class)->finalize (g_obj);
}
......@@ -810,7 +814,6 @@ setup_lock_down (MainMenuUI *this)
SYSTEM_VIS_GCONF_KEY, lockdown_notify_cb, this);
priv->showable_types_gconf_mntr_id = libslab_gconf_notify_add (
SHOWABLE_TYPES_GCONF_KEY, lockdown_notify_cb, this);
priv->modifiable_system_gconf_mntr_id = libslab_gconf_notify_add (
MODIFIABLE_SYSTEM_GCONF_KEY, lockdown_notify_cb, this);
priv->modifiable_apps_gconf_mntr_id = libslab_gconf_notify_add (
......@@ -819,6 +822,8 @@ setup_lock_down (MainMenuUI *this)
MODIFIABLE_DOCS_GCONF_KEY, lockdown_notify_cb, this);
priv->modifiable_dirs_gconf_mntr_id = libslab_gconf_notify_add (
MODIFIABLE_DIRS_GCONF_KEY, lockdown_notify_cb, this);
priv->disable_term_gconf_mntr_id = libslab_gconf_notify_add (
DISABLE_TERMINAL_GCONF_KEY, lockdown_notify_cb, this);
}
static void
......@@ -1222,6 +1227,7 @@ apply_lockdown_settings (MainMenuUI *this)
tile_table_reload (priv->sys_table);
tile_table_reload (priv->file_tables [USER_APPS_TABLE]);
tile_table_reload (priv->file_tables [RCNT_APPS_TABLE]);
tile_table_reload (priv->file_tables [USER_DOCS_TABLE]);
tile_table_reload (priv->file_tables [USER_DIRS_TABLE]);
......
......@@ -26,7 +26,8 @@
#include "application-tile.h"
#include "libslab-utils.h"
#define APP_BLACKLIST_GCONF_KEY "/desktop/gnome/applications/main-menu/file-area/file_blacklist"
#define APP_BLACKLIST_GCONF_KEY "/desktop/gnome/applications/main-menu/file-area/file_blacklist"
#define DISABLE_TERMINAL_GCONF_KEY "/desktop/gnome/lockdown/disable_command_line"
G_DEFINE_TYPE (RecentAppsTileTable, recent_apps_tile_table, TILE_TABLE_TYPE)
......@@ -150,11 +151,18 @@ uri_is_in_blacklist (const gchar *uri)
{
GList *blacklist;
gboolean blacklisted = FALSE;
gboolean disable_term;
gboolean blacklisted;
GList *node;
disable_term = GPOINTER_TO_INT (libslab_get_gconf_value (DISABLE_TERMINAL_GCONF_KEY));
blacklisted = disable_term && libslab_desktop_item_is_a_terminal (uri);
if (blacklisted)
return TRUE;
blacklist = libslab_get_gconf_value (APP_BLACKLIST_GCONF_KEY);
for (node = blacklist; node; node = node->next) {
......
......@@ -25,6 +25,8 @@
#include "application-tile.h"
#include "libslab-utils.h"
#define DISABLE_TERMINAL_GCONF_KEY "/desktop/gnome/lockdown/disable_command_line"
G_DEFINE_TYPE (UserAppsTileTable, user_apps_tile_table, BOOKMARK_TILE_TABLE_TYPE)
static void update_store (LibSlabBookmarkFile *, LibSlabBookmarkFile *, const gchar *);
......@@ -84,7 +86,14 @@ get_application_tile (LibSlabBookmarkFile *bm_file, const gchar *uri)
{
gint uri_len = strlen (uri);
if (! strcmp (& uri [uri_len - 8], ".desktop"))
gboolean disable_term;
gboolean blacklisted;
disable_term = GPOINTER_TO_INT (libslab_get_gconf_value (DISABLE_TERMINAL_GCONF_KEY));
blacklisted = disable_term && libslab_desktop_item_is_a_terminal (uri);
if (! blacklisted && ! strcmp (& uri [uri_len - 8], ".desktop"))
return application_tile_new (uri);
return NULL;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment