summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonsta <[email protected]>2017-10-12 12:51:46 +0300
committermonsta <[email protected]>2017-10-12 12:51:46 +0300
commit5bc0484ea03b7a45739358d3b01d298ddf3a916f (patch)
treebaeb15fa5d091cf87a30514c3490f09434cc41c7
parentb0a9d1377e0f99b3c2a496a12e6973a60ba9e384 (diff)
downloadmate-utils-5bc0484ea03b7a45739358d3b01d298ddf3a916f.tar.bz2
mate-utils-5bc0484ea03b7a45739358d3b01d298ddf3a916f.tar.xz
screenshot: remove some unused code
-rw-r--r--mate-screenshot/src/screenshot-save.c21
-rw-r--r--mate-screenshot/src/screenshot-save.h1
-rw-r--r--mate-screenshot/src/screenshot-utils.c129
-rw-r--r--mate-screenshot/src/screenshot-utils.h1
4 files changed, 0 insertions, 152 deletions
diff --git a/mate-screenshot/src/screenshot-save.c b/mate-screenshot/src/screenshot-save.c
index 5b870eec..a26b16ae 100644
--- a/mate-screenshot/src/screenshot-save.c
+++ b/mate-screenshot/src/screenshot-save.c
@@ -262,24 +262,3 @@ screenshot_save_get_filename (void)
{
return tmp_filename;
}
-
-gchar *
-screenshot_sanitize_filename (const char *filename)
-{
- char *retval, *p;
-
- g_assert (filename);
- g_assert (g_utf8_validate (filename, -1, NULL));
-
- retval = g_uri_escape_string (filename,
- "/",
- TRUE);
-
- for (p = retval; *p != '\000'; p = g_utf8_next_char (p))
- {
- if (*p == G_DIR_SEPARATOR)
- *p = '-';
- }
-
- return retval;
-}
diff --git a/mate-screenshot/src/screenshot-save.h b/mate-screenshot/src/screenshot-save.h
index 9df442d2..ccca2f5f 100644
--- a/mate-screenshot/src/screenshot-save.h
+++ b/mate-screenshot/src/screenshot-save.h
@@ -28,7 +28,6 @@ void screenshot_save_start (GdkPixbuf *pixbuf,
SaveFunction callback,
gpointer user_data);
const char *screenshot_save_get_filename (void);
-gchar *screenshot_sanitize_filename (const char *filename);
#endif /* __SCREENSHOT_SAVE_H__ */
diff --git a/mate-screenshot/src/screenshot-utils.c b/mate-screenshot/src/screenshot-utils.c
index e0a34e8d..28beb78f 100644
--- a/mate-screenshot/src/screenshot-utils.c
+++ b/mate-screenshot/src/screenshot-utils.c
@@ -35,55 +35,6 @@ static GtkWidget *selection_window;
#define SELECTION_NAME "_MATE_PANEL_SCREENSHOT"
-static char *
-get_utf8_property (GdkWindow *window,
- GdkAtom atom)
-{
- gboolean res;
- GdkAtom utf8_string;
- GdkAtom type;
- int actual_format, actual_length;
- guchar *data;
- char *retval;
-
- utf8_string = gdk_x11_xatom_to_atom (gdk_x11_get_xatom_by_name ("UTF8_STRING"));
- res = gdk_property_get (window, atom, utf8_string,
- 0, G_MAXLONG, FALSE,
- &type,
- &actual_format, &actual_length,
- &data);
- if (!res)
- return NULL;
-
- if (type != utf8_string || actual_format != 8 || actual_length == 0)
- {
- g_free (data);
- return NULL;
- }
-
- if (!g_utf8_validate ((gchar *) data, actual_length, NULL))
- {
- char *atom_name = gdk_atom_name (atom);
-
- g_warning ("Property `%s' (format: %d, length: %d) contained "
- "invalid UTF-8",
- atom_name,
- actual_format,
- actual_length);
-
- g_free (atom_name);
- g_free (data);
-
- return NULL;
- }
-
- retval = g_strndup ((gchar *) data, actual_length);
-
- g_free (data);
-
- return retval;
-}
-
/* To make sure there is only one screenshot taken at a time,
* (Imagine key repeat for the print screen key) we hold a selection
* until we are done taking the screenshot
@@ -204,69 +155,6 @@ screenshot_window_is_desktop (GdkWindow *window)
}
-#define MAXIMUM_WM_REPARENTING_DEPTH 4
-
-static GdkWindow *
-look_for_hint_helper (GdkWindow *window,
- GdkAtom property,
- int depth)
-{
- gboolean res;
- GdkAtom actual_type;
- int actual_format, actual_length;
- guchar *data;
-
- res = gdk_property_get (window, property, GDK_NONE,
- 0, 1, FALSE,
- &actual_type,
- &actual_format, &actual_length,
- &data);
-
- if (res == TRUE &&
- data != NULL &&
- actual_format == 32 &&
- data[0] == 1)
- {
- g_free (data);
-
- return window;
- }
-
- if (depth < MAXIMUM_WM_REPARENTING_DEPTH)
- {
- GList *children, *l;
-
- children = gdk_window_get_children (window);
- if (children != NULL)
- {
- for (l = children; l; l = l->next)
- {
- window = look_for_hint_helper (l->data, property, depth + 1);
- if (window)
- break;
- }
-
- g_list_free (children);
-
- if (window)
- return window;
- }
- }
-
- return NULL;
-}
-
-static GdkWindow *
-look_for_hint (GdkWindow *window,
- GdkAtom property)
-{
- GdkWindow *retval;
-
- retval = look_for_hint_helper (window, property, 0);
-
- return retval;
-}
-
GdkWindow *
screenshot_find_current_window ()
{
@@ -990,23 +878,6 @@ screenshot_get_pixbuf (GdkWindow *window,
return screenshot;
}
-gchar *
-screenshot_get_window_title (GdkWindow *win)
-{
- gchar *name;
-
- win = gdk_window_get_toplevel (win);
- win = look_for_hint (win, gdk_x11_xatom_to_atom (gdk_x11_get_xatom_by_name ("WM_STATE")));
-
- name = get_utf8_property (win, gdk_x11_xatom_to_atom (gdk_x11_get_xatom_by_name ("_NET_WM_NAME")));
- if (name)
- return name;
-
- /* TODO: maybe we should also look at WM_NAME and WM_CLASS? */
-
- return g_strdup (_("Untitled Window"));
-}
-
void
screenshot_show_error_dialog (GtkWindow *parent,
const gchar *message,
diff --git a/mate-screenshot/src/screenshot-utils.h b/mate-screenshot/src/screenshot-utils.h
index b9d13f7b..88fd43ea 100644
--- a/mate-screenshot/src/screenshot-utils.h
+++ b/mate-screenshot/src/screenshot-utils.h
@@ -29,7 +29,6 @@ typedef void (* SelectAreaCallback) (GdkRectangle *rectangle);
gboolean screenshot_grab_lock (void);
void screenshot_release_lock (void);
-gchar *screenshot_get_window_title (GdkWindow *win);
GdkWindow *screenshot_find_current_window (void);
void screenshot_select_area_async (SelectAreaCallback callback);
GdkPixbuf *screenshot_get_pixbuf (GdkWindow *win,