summaryrefslogtreecommitdiff
path: root/libslab
diff options
context:
space:
mode:
authormonsta <[email protected]>2017-12-22 21:01:59 +0300
committermonsta <[email protected]>2017-12-22 21:01:59 +0300
commitd12302def2b23e124509f54afd0d9da49651d9f3 (patch)
treeea045e8c8fbf1aabbd7d9580387ae7b67342497f /libslab
parent8d737c695f37a5bb0ad5ded56a44777249624cea (diff)
downloadmate-control-center-d12302def2b23e124509f54afd0d9da49651d9f3.tar.bz2
mate-control-center-d12302def2b23e124509f54afd0d9da49651d9f3.tar.xz
libslab: remove a bunch of unused code
Diffstat (limited to 'libslab')
-rw-r--r--libslab/app-resizer.c6
-rw-r--r--libslab/app-resizer.h1
-rw-r--r--libslab/libslab-utils.c272
-rw-r--r--libslab/libslab-utils.h13
-rw-r--r--libslab/mate-utils.c26
-rw-r--r--libslab/mate-utils.h1
-rw-r--r--libslab/slab-mate-util.c90
-rw-r--r--libslab/slab-mate-util.h5
8 files changed, 0 insertions, 414 deletions
diff --git a/libslab/app-resizer.c b/libslab/app-resizer.c
index d26303be..228ceee1 100644
--- a/libslab/app-resizer.c
+++ b/libslab/app-resizer.c
@@ -177,12 +177,6 @@ app_resizer_set_table_cache (AppResizer * widget, GList * cache_list)
widget->cached_tables_list = cache_list;
}
-void
-app_resizer_set_homogeneous (AppResizer * widget, gboolean homogeneous)
-{
- widget->table_elements_homogeneous = homogeneous;
-}
-
static void
app_resizer_size_allocate (GtkWidget * widget, GtkAllocation * allocation)
{
diff --git a/libslab/app-resizer.h b/libslab/app-resizer.h
index 67f1cc33..57411ec6 100644
--- a/libslab/app-resizer.h
+++ b/libslab/app-resizer.h
@@ -60,7 +60,6 @@ struct _AppResizerClass
GtkLayoutClass parent_class;
};
-void app_resizer_set_homogeneous (AppResizer * widget, gboolean value);
void remove_container_entries (GtkContainer * widget);
GType app_resizer_get_type (void);
diff --git a/libslab/libslab-utils.c b/libslab/libslab-utils.c
index 94056951..622c99c7 100644
--- a/libslab/libslab-utils.c
+++ b/libslab/libslab-utils.c
@@ -18,75 +18,6 @@
static FILE *checkpoint_file;
-gboolean
-libslab_gtk_image_set_by_id (GtkImage *image, const gchar *id)
-{
- GdkPixbuf *pixbuf;
-
- gint size;
- gint width;
- gint height;
-
- GtkIconTheme *icon_theme;
-
- gboolean found;
-
- gchar *tmp;
-
-
- if (! id)
- return FALSE;
-
- g_object_get (G_OBJECT (image), "icon-size", & size, NULL);
-
- if (size == GTK_ICON_SIZE_INVALID)
- size = GTK_ICON_SIZE_DND;
-
- gtk_icon_size_lookup (size, & width, & height);
-
- if (g_path_is_absolute (id)) {
- pixbuf = gdk_pixbuf_new_from_file_at_size (id, width, height, NULL);
-
- found = (pixbuf != NULL);
-
- if (found) {
- gtk_image_set_from_pixbuf (image, pixbuf);
-
- g_object_unref (pixbuf);
- }
- else
- gtk_image_set_from_icon_name (image, "image-missing", size);
- }
- else {
- tmp = g_strdup (id);
-
- if ( /* file extensions are not copesetic with loading by "name" */
- g_str_has_suffix (tmp, ".png") ||
- g_str_has_suffix (tmp, ".svg") ||
- g_str_has_suffix (tmp, ".xpm")
- )
-
- tmp [strlen (tmp) - 4] = '\0';
-
- if (gtk_widget_has_screen (GTK_WIDGET (image)))
- icon_theme = gtk_icon_theme_get_for_screen (
- gtk_widget_get_screen (GTK_WIDGET (image)));
- else
- icon_theme = gtk_icon_theme_get_default ();
-
- found = gtk_icon_theme_has_icon (icon_theme, tmp);
-
- if (found)
- gtk_image_set_from_icon_name (image, tmp, size);
- else
- gtk_image_set_from_icon_name (image, "image-missing", size);
-
- g_free (tmp);
- }
-
- return found;
-}
-
MateDesktopItem *
libslab_mate_desktop_item_new_from_unknown_id (const gchar *id)
{
@@ -144,41 +75,6 @@ libslab_mate_desktop_item_new_from_unknown_id (const gchar *id)
return NULL;
}
-gboolean
-libslab_mate_desktop_item_launch_default (MateDesktopItem *item)
-{
- GError *error = NULL;
-
- if (! item)
- return FALSE;
-
- mate_desktop_item_launch (item, NULL, MATE_DESKTOP_ITEM_LAUNCH_ONLY_ONE, & error);
-
- if (error) {
- g_warning ("error launching %s [%s]\n",
- mate_desktop_item_get_location (item), error->message);
-
- g_error_free (error);
-
- return FALSE;
- }
-
- return TRUE;
-}
-
-gchar *
-libslab_mate_desktop_item_get_docpath (MateDesktopItem *item)
-{
- gchar *path;
-
- path = g_strdup (mate_desktop_item_get_localestring (item, MATE_DESKTOP_ITEM_DOC_PATH));
-
- if (! path)
- path = g_strdup (mate_desktop_item_get_localestring (item, ALTERNATE_DOCPATH_KEY));
-
- return path;
-}
-
/* Ugh, here we don't have knowledge of the screen that is being used. So, do
* what we can to find it.
*/
@@ -227,15 +123,6 @@ libslab_strcmp (const gchar *a, const gchar *b)
return strcmp (a, b);
}
-gint
-libslab_strlen (const gchar *a)
-{
- if (! a)
- return 0;
-
- return strlen (a);
-}
-
void
libslab_handle_g_error (GError **error, const gchar *msg_format, ...)
{
@@ -262,104 +149,6 @@ libslab_handle_g_error (GError **error, const gchar *msg_format, ...)
g_free (msg);
}
-gboolean
-libslab_desktop_item_is_a_terminal (const gchar *uri)
-{
- MateDesktopItem *d_item;
- const gchar *categories;
-
- gboolean is_terminal = FALSE;
-
-
- d_item = libslab_mate_desktop_item_new_from_unknown_id (uri);
-
- if (! d_item)
- return FALSE;
-
- categories = mate_desktop_item_get_string (d_item, MATE_DESKTOP_ITEM_CATEGORIES);
-
- is_terminal = (categories && strstr (categories, DESKTOP_ITEM_TERMINAL_EMULATOR_FLAG));
-
- mate_desktop_item_unref (d_item);
-
- return is_terminal;
-}
-
-gboolean
-libslab_desktop_item_is_logout (const gchar *uri)
-{
- MateDesktopItem *d_item;
- gboolean is_logout = FALSE;
-
-
- d_item = libslab_mate_desktop_item_new_from_unknown_id (uri);
-
- if (! d_item)
- return FALSE;
-
- is_logout = strstr ("Logout", mate_desktop_item_get_string (d_item, MATE_DESKTOP_ITEM_NAME)) != NULL;
-
- mate_desktop_item_unref (d_item);
-
- return is_logout;
-}
-
-gboolean
-libslab_desktop_item_is_lockscreen (const gchar *uri)
-{
- MateDesktopItem *d_item;
- gboolean is_logout = FALSE;
-
-
- d_item = libslab_mate_desktop_item_new_from_unknown_id (uri);
-
- if (! d_item)
- return FALSE;
-
- is_logout = strstr ("Lock Screen", mate_desktop_item_get_string (d_item, MATE_DESKTOP_ITEM_NAME)) != NULL;
-
- mate_desktop_item_unref (d_item);
-
- return is_logout;
-}
-
-gchar *
-libslab_string_replace_once (const gchar *string, const gchar *key, const gchar *value)
-{
- GString *str_built;
- gint pivot;
-
-
- pivot = strstr (string, key) - string;
-
- str_built = g_string_new_len (string, pivot);
- g_string_append (str_built, value);
- g_string_append (str_built, & string [pivot + strlen (key)]);
-
- return g_string_free (str_built, FALSE);
-}
-
-void
-libslab_spawn_command (const gchar *cmd)
-{
- gchar **argv;
-
- GError *error = NULL;
-
-
- if (! cmd || strlen (cmd) < 1)
- return;
-
- argv = g_strsplit (cmd, " ", -1);
-
- g_spawn_async (NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, & error);
-
- if (error)
- libslab_handle_g_error (& error, "%s: error spawning [%s]", G_STRFUNC, cmd);
-
- g_strfreev (argv);
-}
-
static guint thumbnail_factory_idle_id;
static MateDesktopThumbnailFactory *thumbnail_factory;
@@ -388,67 +177,6 @@ init_thumbnail_factory_idle_cb (gpointer data)
}
void
-libslab_thumbnail_factory_preinit (void)
-{
- thumbnail_factory_idle_id = g_idle_add (init_thumbnail_factory_idle_cb, NULL);
-}
-
-MateDesktopThumbnailFactory *
-libslab_thumbnail_factory_get (void)
-{
- if (thumbnail_factory_idle_id != 0) {
- g_source_remove (thumbnail_factory_idle_id);
- thumbnail_factory_idle_id = 0;
-
- create_thumbnail_factory ();
- }
-
- g_assert (thumbnail_factory != NULL);
- return thumbnail_factory;
-}
-
-void
-libslab_checkpoint_init (const char *checkpoint_config_file_basename,
- const char *checkpoint_file_basename)
-{
- char *filename;
- struct stat st;
- int result;
- time_t t;
- struct tm tm;
- char *checkpoint_full_basename;
-
- g_return_if_fail (checkpoint_config_file_basename != NULL);
- g_return_if_fail (checkpoint_file_basename != NULL);
-
- filename = g_build_filename (g_get_home_dir (), checkpoint_config_file_basename, NULL);
-
- result = stat (filename, &st);
- g_free (filename);
-
- if (result != 0)
- return;
-
- t = time (NULL);
- tm = *localtime (&t);
-
- checkpoint_full_basename = g_strdup_printf ("%s-%04d-%02d-%02d-%02d-%02d-%02d.checkpoint",
- checkpoint_file_basename,
- tm.tm_year + 1900,
- tm.tm_mon + 1,
- tm.tm_mday,
- tm.tm_hour,
- tm.tm_min,
- tm.tm_sec);
-
- filename = g_build_filename (g_get_home_dir (), checkpoint_full_basename, NULL);
- g_free (checkpoint_full_basename);
-
- checkpoint_file = fopen (filename, "w");
- g_free (filename);
-}
-
-void
libslab_checkpoint (const char *format, ...)
{
va_list args;
diff --git a/libslab/libslab-utils.h b/libslab/libslab-utils.h
index f02e36c5..b40290cf 100644
--- a/libslab/libslab-utils.h
+++ b/libslab/libslab-utils.h
@@ -11,26 +11,13 @@
extern "C" {
#endif
-gboolean libslab_gtk_image_set_by_id (GtkImage *image, const gchar *id);
MateDesktopItem *libslab_mate_desktop_item_new_from_unknown_id (const gchar *id);
-gboolean libslab_mate_desktop_item_launch_default (MateDesktopItem *item);
-gchar *libslab_mate_desktop_item_get_docpath (MateDesktopItem *item);
guint32 libslab_get_current_time_millis (void);
gint libslab_strcmp (const gchar *a, const gchar *b);
-gint libslab_strlen (const gchar *a);
void libslab_handle_g_error (GError **error, const gchar *msg_format, ...);
-gboolean libslab_desktop_item_is_a_terminal (const gchar *uri);
-gboolean libslab_desktop_item_is_logout (const gchar *uri);
-gboolean libslab_desktop_item_is_lockscreen (const gchar *uri);
-gchar *libslab_string_replace_once (const gchar *string, const gchar *key, const gchar *value);
-void libslab_spawn_command (const gchar *cmd);
GdkScreen *libslab_get_current_screen (void);
-void libslab_thumbnail_factory_preinit (void);
-MateDesktopThumbnailFactory *libslab_thumbnail_factory_get (void);
-
-void libslab_checkpoint_init (const char *checkpoint_config_file_basename, const char *checkpoint_file_basename);
void libslab_checkpoint (const char *format, ...);
#ifdef __cplusplus
diff --git a/libslab/mate-utils.c b/libslab/mate-utils.c
index c3de6a83..90dd9320 100644
--- a/libslab/mate-utils.c
+++ b/libslab/mate-utils.c
@@ -69,29 +69,3 @@ load_image_by_id (GtkImage * image, GtkIconSize size, const gchar * image_id)
return icon_exists;
}
-
-void
-handle_g_error (GError ** error, const gchar * msg_format, ...)
-{
- gchar *msg;
- va_list args;
-
- va_start (args, msg_format);
- msg = g_strdup_vprintf (msg_format, args);
- va_end (args);
-
- if (*error)
- {
- g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING,
- "\nGError raised: [%s]\nuser_message: [%s]\n", (*error)->message, msg);
-
- g_error_free (*error);
-
- *error = NULL;
- }
- else
- g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, "\nerror raised: [%s]\n", msg);
-
- g_free (msg);
-}
-
diff --git a/libslab/mate-utils.h b/libslab/mate-utils.h
index a018e4a1..cf2f315e 100644
--- a/libslab/mate-utils.h
+++ b/libslab/mate-utils.h
@@ -29,7 +29,6 @@ extern "C" {
gboolean load_image_by_id (GtkImage * image, GtkIconSize size,
const gchar * image_id);
-void handle_g_error (GError ** error, const gchar * user_format, ...);
#ifdef __cplusplus
}
diff --git a/libslab/slab-mate-util.c b/libslab/slab-mate-util.c
index 15a61ddb..efb4a535 100644
--- a/libslab/slab-mate-util.c
+++ b/libslab/slab-mate-util.c
@@ -139,96 +139,6 @@ open_desktop_item_help (MateDesktopItem * desktop_item)
return TRUE;
}
-gboolean
-slab_load_image (GtkImage * image, GtkIconSize size, const gchar * image_id)
-{
- GdkPixbuf *pixbuf;
- gint width;
- gint height;
-
- gchar *id;
-
- if (!image_id)
- return FALSE;
-
- id = g_strdup (image_id);
-
- gtk_icon_size_lookup (size, &width, &height);
-
- if (g_path_is_absolute (id))
- pixbuf = gdk_pixbuf_new_from_file_at_size (id, width, height, NULL);
- else
- {
- if ( /* file extensions are not copesetic with loading by "name" */
- g_str_has_suffix (id, ".png") ||
- g_str_has_suffix (id, ".svg") ||
- g_str_has_suffix (id, ".xpm")
- )
-
- id[strlen (id) - 4] = '\0';
-
- pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), id, width, 0,
- NULL);
- }
-
- if (pixbuf)
- {
- gtk_image_set_from_pixbuf (image, pixbuf);
-
- g_object_unref (pixbuf);
-
- g_free (id);
-
- return TRUE;
- }
- else
- { /* This will make it show the "broken image" icon */
- gtk_image_set_from_file (image, id);
-
- g_free (id);
-
- return FALSE;
- }
-}
-
-gchar *
-string_replace_once (const gchar * str_template, const gchar * key, const gchar * value)
-{
- GString *str_built;
- gint pivot;
-
- pivot = strstr (str_template, key) - str_template;
-
- str_built = g_string_new_len (str_template, pivot);
- g_string_append (str_built, value);
- g_string_append (str_built, &str_template[pivot + strlen (key)]);
-
- return g_string_free (str_built, FALSE);
-}
-
-void
-spawn_process (const gchar *command)
-{
- gchar **argv;
- GError *error = NULL;
-
- if (!command || strlen (command) < 1)
- return;
-
- argv = g_strsplit (command, " ", -1);
-
- g_spawn_async (NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &error);
-
- if (error)
- {
- g_warning ("error spawning [%s]: [%s]\n", command, error->message);
-
- g_error_free (error);
- }
-
- g_strfreev (argv);
-}
-
void
copy_file (const gchar * src_uri, const gchar * dst_uri)
{
diff --git a/libslab/slab-mate-util.h b/libslab/slab-mate-util.h
index 1ecb4454..02a8cd10 100644
--- a/libslab/slab-mate-util.h
+++ b/libslab/slab-mate-util.h
@@ -52,11 +52,6 @@ MateDesktopItem *load_desktop_item_from_unknown (const gchar * id);
gboolean open_desktop_item_exec (MateDesktopItem * desktop_item);
gboolean open_desktop_item_help (MateDesktopItem * desktop_item);
-gboolean slab_load_image (GtkImage * image, GtkIconSize size, const gchar * image_id);
-
-gchar *string_replace_once (const gchar * str_template, const gchar * key, const gchar * value);
-
-void spawn_process (const gchar * command);
void copy_file (const gchar * src_uri, const gchar * dst_uri);
#ifdef __cplusplus