diff options
author | rbuj <[email protected]> | 2019-09-11 12:08:22 +0200 |
---|---|---|
committer | lukefromdc <[email protected]> | 2019-09-15 03:48:47 +0000 |
commit | 6e2ab64994fd6ca44305b0eb37f7cf444abcab6d (patch) | |
tree | b2cee8e9d1f2acff7df514844d1de7c4d4456023 | |
parent | bfc93ef400c067e191b6d96b593fcad8edee9793 (diff) | |
download | engrampa-6e2ab64994fd6ca44305b0eb37f7cf444abcab6d.tar.bz2 engrampa-6e2ab64994fd6ca44305b0eb37f7cf444abcab6d.tar.xz |
glib-utils & gtk-utils: Remove unused functions
cppcheck --enable=unusedFunction .
-rw-r--r-- | src/glib-utils.c | 139 | ||||
-rw-r--r-- | src/glib-utils.h | 13 | ||||
-rw-r--r-- | src/gtk-utils.c | 150 | ||||
-rw-r--r-- | src/gtk-utils.h | 13 |
4 files changed, 0 insertions, 315 deletions
diff --git a/src/glib-utils.c b/src/glib-utils.c index 9768627..57298e4 100644 --- a/src/glib-utils.c +++ b/src/glib-utils.c @@ -35,16 +35,6 @@ /* gobject utils*/ -gpointer -_g_object_ref (gpointer object) -{ - if (object != NULL) - return g_object_ref (object); - else - return NULL; -} - - void _g_object_unref (gpointer object) { @@ -185,14 +175,6 @@ escape_str (const char *str, } -/* escape with backslash the file name. */ -char* -shell_escape (const char *filename) -{ - return escape_str (filename, "$'`\"\\!?* ()[]&|:;<>#"); -} - - static const char * g_utf8_strstr (const char *haystack, const char *needle) { @@ -407,34 +389,6 @@ search_util_get_regexps (const char *pattern_string, } -char * -_g_strdup_with_max_size (const char *s, - int max_size) -{ - char *result; - int l = strlen (s); - - if (l > max_size) { - char *first_half; - char *second_half; - int offset; - int half_max_size = max_size / 2 + 1; - - first_half = g_strndup (s, half_max_size); - offset = half_max_size + l - max_size; - second_half = g_strndup (s + offset, half_max_size); - - result = g_strconcat (first_half, "...", second_half, NULL); - - g_free (first_half); - g_free (second_half); - } else - result = g_strdup (s); - - return result; -} - - const char * eat_spaces (const char *line) { @@ -446,17 +400,6 @@ eat_spaces (const char *line) } -const char * -eat_void_chars (const char *line) -{ - if (line == NULL) - return NULL; - while (((*line == ' ') || (*line == '\t')) && (*line != 0)) - line++; - return line; -} - - char ** split_line (const char *line, int n_fields) @@ -557,45 +500,6 @@ g_ptr_array_free_full (GPtrArray *array, } -void -g_ptr_array_reverse (GPtrArray *array) -{ - int i, j; - gpointer tmp; - - for (i = 0; i < array->len / 2; i++) { - j = array->len - i - 1; - tmp = g_ptr_array_index (array, i); - g_ptr_array_index (array, i) = g_ptr_array_index (array, j); - g_ptr_array_index (array, j) = tmp; - } -} - - -int -g_ptr_array_binary_search (GPtrArray *array, - gpointer value, - GCompareFunc func) -{ - int l, r, p, cmp = -1; - - l = 0; - r = array->len; - while (l < r) { - p = l + ((r - l) / 2); - cmp = func(value, &g_ptr_array_index (array, p)); - if (cmp == 0) - return p; - else if (cmp < 0) - r = p; - else - l = p + 1; - } - - return -1; -} - - GHashTable *static_strings = NULL; @@ -634,49 +538,6 @@ g_uri_display_basename (const char *uri) } -char ** -_g_strv_prepend (char **str_array, - const char *str) -{ - char **result; - int i; - int j; - - result = g_new (char *, g_strv_length (str_array) + 1); - i = 0; - result[i++] = g_strdup (str); - for (j = 0; str_array[j] != NULL; j++) - result[i++] = g_strdup (str_array[j]); - result[i] = NULL; - - return result; -} - - -gboolean -_g_strv_remove (char **str_array, - const char *str) -{ - int i; - int j; - - if (str == NULL) - return FALSE; - - for (i = 0; str_array[i] != NULL; i++) - if (strcmp (str_array[i], str) == 0) - break; - - if (str_array[i] == NULL) - return FALSE; - - for (j = i; str_array[j] != NULL; j++) - str_array[j] = str_array[j + 1]; - - return TRUE; -} - - const gchar * _g_path_get_file_name (const gchar *file_name) { diff --git a/src/glib-utils.h b/src/glib-utils.h index 674a17e..957aff9 100644 --- a/src/glib-utils.h +++ b/src/glib-utils.h @@ -31,7 +31,6 @@ /* gobject utils */ -gpointer _g_object_ref (gpointer object); void _g_object_unref (gpointer object); /* string utils */ @@ -48,7 +47,6 @@ char* escape_str_common (const char *str, const char postfix); char* escape_str (const char *str, const char *meta_chars); -gchar * shell_escape (const gchar *filename); gboolean match_regexps (GRegex **regexps, const char *string, GRegexMatchFlags match_options); @@ -56,10 +54,7 @@ char ** search_util_get_patterns (const char *pattern_string); GRegex ** search_util_get_regexps (const char *pattern_string, GRegexCompileFlags compile_options); void free_regexps (GRegex **regexps); -char * _g_strdup_with_max_size (const char *s, - int max_size); const char * eat_spaces (const char *line); -const char * eat_void_chars (const char *line); char ** split_line (const char *line, int n_fields); const char * get_last_field (const char *line, @@ -68,16 +63,8 @@ int n_fields (char **str_array); void g_ptr_array_free_full (GPtrArray *array, GFunc func, gpointer user_data); -void g_ptr_array_reverse (GPtrArray *array); -int g_ptr_array_binary_search (GPtrArray *array, - gpointer value, - GCompareFunc func); const char * get_static_string (const char *s); char* g_uri_display_basename (const char *uri); -char ** _g_strv_prepend (char **str_array, - const char *str); -gboolean _g_strv_remove (char **str_array, - const char *str); /* path filename */ diff --git a/src/gtk-utils.c b/src/gtk-utils.c index 45fe9bb..890cbc7 100644 --- a/src/gtk-utils.c +++ b/src/gtk-utils.c @@ -272,71 +272,6 @@ _gtk_request_dialog_run (GtkWindow *parent, GtkWidget* -_gtk_yesno_dialog_new (GtkWindow *parent, - GtkDialogFlags flags, - const char *message, - const char *no_button_text, - const char *yes_button_text) -{ - GtkWidget *d; - GtkWidget *label; - GtkWidget *image; - GtkWidget *hbox; - GtkWidget *button; - GtkWidget *content_area; - - d = gtk_dialog_new_with_buttons ("", parent, flags, NULL, NULL); - gtk_window_set_resizable (GTK_WINDOW (d), FALSE); - - content_area = gtk_dialog_get_content_area (GTK_DIALOG (d)); - - /* Add label and image */ - - image = gtk_image_new_from_icon_name ("dialog-warning", GTK_ICON_SIZE_DIALOG); - gtk_widget_set_valign (image, GTK_ALIGN_START); - - label = gtk_label_new (message); - gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); - gtk_label_set_selectable (GTK_LABEL (label), TRUE); - - hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 24); - gtk_container_set_border_width (GTK_CONTAINER (hbox), 6); - - gtk_box_pack_start (GTK_BOX (hbox), image, - FALSE, FALSE, 0); - - gtk_box_pack_start (GTK_BOX (hbox), label, - TRUE, TRUE, 0); - - gtk_box_pack_start (GTK_BOX (content_area), - hbox, - FALSE, FALSE, 0); - - gtk_widget_show_all (hbox); - - /* Add buttons */ - - button = create_button ("gtk-cancel", no_button_text); - gtk_dialog_add_action_widget (GTK_DIALOG (d), - button, - GTK_RESPONSE_CANCEL); - - /**/ - - button = create_button ("gtk-ok", yes_button_text); - gtk_dialog_add_action_widget (GTK_DIALOG (d), - button, - GTK_RESPONSE_YES); - - /**/ - - gtk_dialog_set_default_response (GTK_DIALOG (d), GTK_RESPONSE_YES); - - return d; -} - - -GtkWidget* _gtk_error_dialog_new (GtkWindow *parent, GtkDialogFlags flags, GList *row_output, @@ -544,37 +479,6 @@ _gtk_entry_get_locale_text (GtkEntry *entry) void -_gtk_label_set_locale_text (GtkLabel *label, - const char *text) -{ - char *utf8_text; - - utf8_text = g_locale_to_utf8 (text, -1, NULL, NULL, NULL); - if (utf8_text != NULL) { - gtk_label_set_text (label, utf8_text); - g_free (utf8_text); - } else - gtk_label_set_text (label, ""); -} - - -char * -_gtk_label_get_locale_text (GtkLabel *label) -{ - const char *utf8_text; - char *text; - - utf8_text = gtk_label_get_text (label); - if (utf8_text == NULL) - return NULL; - - text = g_locale_from_utf8 (utf8_text, -1, NULL, NULL, NULL); - - return text; -} - - -void _gtk_entry_set_filename_text (GtkEntry *entry, const char *text) { @@ -589,50 +493,6 @@ _gtk_entry_set_filename_text (GtkEntry *entry, } -char * -_gtk_entry_get_filename_text (GtkEntry *entry) -{ - const char *utf8_text; - char *text; - - utf8_text = gtk_entry_get_text (entry); - if (utf8_text == NULL) - return NULL; - - text = g_filename_from_utf8 (utf8_text, -1, NULL, NULL, NULL); - - return text; -} - - -void -_gtk_label_set_filename_text (GtkLabel *label, - const char *text) -{ - char *utf8_text; - - utf8_text = g_filename_display_name (text); - gtk_label_set_text (label, utf8_text); - g_free (utf8_text); -} - - -char * -_gtk_label_get_filename_text (GtkLabel *label) -{ - const char *utf8_text; - char *text; - - utf8_text = gtk_label_get_text (label); - if (utf8_text == NULL) - return NULL; - - text = g_filename_from_utf8 (utf8_text, -1, NULL, NULL, NULL); - - return text; -} - - static GdkPixbuf * get_themed_icon_pixbuf (GThemedIcon *icon, int size, @@ -713,16 +573,6 @@ get_mime_type_pixbuf (const char *mime_type, return pixbuf; } -int -get_folder_pixbuf_size_for_list (GtkWidget *widget) -{ - int icon_width, icon_height; - - gtk_icon_size_lookup (GTK_ICON_SIZE_SMALL_TOOLBAR, - &icon_width, &icon_height); - return MAX (icon_width, icon_height); -} - void show_help_dialog (GtkWindow *parent, const char *section) diff --git a/src/gtk-utils.h b/src/gtk-utils.h index f75e274..9d43078 100644 --- a/src/gtk-utils.h +++ b/src/gtk-utils.h @@ -43,11 +43,6 @@ gchar* _gtk_request_dialog_run (GtkWindow *parent, int max_length, const char *no_button_text, const char *yes_button_text); -GtkWidget* _gtk_yesno_dialog_new (GtkWindow *parent, - GtkDialogFlags flags, - const char *message, - const char *no_button_text, - const char *yes_button_text); GtkWidget* _gtk_error_dialog_new (GtkWindow *parent, GtkDialogFlags flags, GList *row_output, @@ -61,22 +56,14 @@ void _gtk_error_dialog_run (GtkWindow *parent, void _gtk_entry_set_locale_text (GtkEntry *entry, const char *text); char * _gtk_entry_get_locale_text (GtkEntry *entry); -void _gtk_label_set_locale_text (GtkLabel *label, - const char *text); -char * _gtk_label_get_locale_text (GtkLabel *label); void _gtk_entry_set_filename_text (GtkEntry *entry, const char *text); -char * _gtk_entry_get_filename_text (GtkEntry *entry); -void _gtk_label_set_filename_text (GtkLabel *label, - const char *text); -char * _gtk_label_get_filename_text (GtkLabel *label); GdkPixbuf * get_icon_pixbuf (GIcon *icon, int size, GtkIconTheme *icon_theme); GdkPixbuf * get_mime_type_pixbuf (const char *mime_type, int icon_size, GtkIconTheme *icon_theme); -int get_folder_pixbuf_size_for_list (GtkWidget *widget); void show_help_dialog (GtkWindow *parent, const char *section); GtkBuilder * |