xed/pluma/pluma-utils.h

163 lines
4.9 KiB
C
Raw Normal View History

2011-11-07 13:46:58 -06:00
/*
2011-11-07 16:52:18 -06:00
* pluma-utils.h
* This file is part of pluma
2011-11-07 13:46:58 -06:00
*
* Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
* Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi
* Copyright (C) 2002 - 2005 Paolo Maggi
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
2012-11-18 19:54:49 -06:00
* Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
2011-11-07 13:46:58 -06:00
*/
/*
2011-11-07 16:52:18 -06:00
* Modified by the pluma Team, 1998-2005. See the AUTHORS file for a
* list of people on the pluma Team.
2011-11-07 13:46:58 -06:00
* See the ChangeLog files for a list of changes.
*
* $Id$
*/
2011-11-07 16:52:18 -06:00
#ifndef __PLUMA_UTILS_H__
#define __PLUMA_UTILS_H__
2011-11-07 13:46:58 -06:00
#include <glib.h>
#include <gtk/gtk.h>
#include <atk/atk.h>
2011-11-07 16:52:18 -06:00
#include <pluma/pluma-encodings.h>
2011-11-07 13:46:58 -06:00
G_BEGIN_DECLS
/* useful macro */
#define GBOOLEAN_TO_POINTER(i) (GINT_TO_POINTER ((i) ? 2 : 1))
#define GPOINTER_TO_BOOLEAN(i) ((gboolean) ((GPOINTER_TO_INT(i) == 2) ? TRUE : FALSE))
#define IS_VALID_BOOLEAN(v) (((v == TRUE) || (v == FALSE)) ? TRUE : FALSE)
2011-11-07 16:52:18 -06:00
enum { PLUMA_ALL_WORKSPACES = 0xffffffff };
2011-11-07 13:46:58 -06:00
2011-11-07 16:52:18 -06:00
gboolean pluma_utils_uri_has_writable_scheme (const gchar *uri);
gboolean pluma_utils_uri_has_file_scheme (const gchar *uri);
2011-11-07 13:46:58 -06:00
2011-11-07 16:52:18 -06:00
void pluma_utils_menu_position_under_widget (GtkMenu *menu,
2011-11-07 13:46:58 -06:00
gint *x,
gint *y,
gboolean *push_in,
gpointer user_data);
2011-11-07 16:52:18 -06:00
void pluma_utils_menu_position_under_tree_view
2011-11-07 13:46:58 -06:00
(GtkMenu *menu,
gint *x,
gint *y,
gboolean *push_in,
gpointer user_data);
2011-11-07 16:52:18 -06:00
gchar *pluma_gdk_color_to_string (GdkColor color);
2011-11-07 13:46:58 -06:00
2011-11-07 16:52:18 -06:00
GtkWidget *pluma_gtk_button_new_with_stock_icon (const gchar *label,
2011-11-07 13:46:58 -06:00
const gchar *stock_id);
2011-11-07 16:52:18 -06:00
GtkWidget *pluma_dialog_add_button (GtkDialog *dialog,
2011-11-07 13:46:58 -06:00
const gchar *text,
const gchar *stock_id,
gint response_id);
2011-11-07 16:52:18 -06:00
gchar *pluma_utils_escape_underscores (const gchar *text,
2011-11-07 13:46:58 -06:00
gssize length);
2011-11-07 16:52:18 -06:00
gchar *pluma_utils_str_middle_truncate (const gchar *string,
2011-11-07 13:46:58 -06:00
guint truncate_length);
2011-11-07 16:52:18 -06:00
gchar *pluma_utils_str_end_truncate (const gchar *string,
2011-11-07 13:46:58 -06:00
guint truncate_length);
gboolean g_utf8_caselessnmatch (const char *s1,
const char *s2,
gssize n1,
gssize n2);
2011-11-07 16:52:18 -06:00
void pluma_utils_set_atk_name_description (GtkWidget *widget,
2011-11-07 13:46:58 -06:00
const gchar *name,
const gchar *description);
2011-11-07 16:52:18 -06:00
void pluma_utils_set_atk_relation (GtkWidget *obj1,
2011-11-07 13:46:58 -06:00
GtkWidget *obj2,
AtkRelationType rel_type);
2011-11-07 16:52:18 -06:00
gboolean pluma_utils_uri_exists (const gchar* text_uri);
2011-11-07 13:46:58 -06:00
2011-11-07 16:52:18 -06:00
gchar *pluma_utils_escape_search_text (const gchar *text);
2011-11-07 13:46:58 -06:00
2011-11-07 16:52:18 -06:00
gchar *pluma_utils_unescape_search_text (const gchar *text);
2011-11-07 13:46:58 -06:00
2011-11-07 16:52:18 -06:00
void pluma_warning (GtkWindow *parent,
2011-11-07 13:46:58 -06:00
const gchar *format,
...) G_GNUC_PRINTF(2, 3);
2011-11-07 16:52:18 -06:00
gchar *pluma_utils_make_valid_utf8 (const char *name);
2011-11-07 13:46:58 -06:00
/* Note that this function replace home dir with ~ */
2011-11-07 16:52:18 -06:00
gchar *pluma_utils_uri_get_dirname (const char *uri);
2011-11-07 13:46:58 -06:00
2011-11-07 16:52:18 -06:00
gchar *pluma_utils_location_get_dirname_for_display
2011-11-07 13:46:58 -06:00
(GFile *location);
2011-11-07 16:52:18 -06:00
gchar *pluma_utils_replace_home_dir_with_tilde (const gchar *uri);
2011-11-07 13:46:58 -06:00
2011-11-07 16:52:18 -06:00
guint pluma_utils_get_current_workspace (GdkScreen *screen);
2011-11-07 13:46:58 -06:00
2011-11-07 16:52:18 -06:00
guint pluma_utils_get_window_workspace (GtkWindow *gtkwindow);
2011-11-07 13:46:58 -06:00
2011-11-07 16:52:18 -06:00
void pluma_utils_get_current_viewport (GdkScreen *screen,
2011-11-07 13:46:58 -06:00
gint *x,
gint *y);
2011-11-07 16:52:18 -06:00
void pluma_utils_activate_url (GtkAboutDialog *about,
2011-11-07 13:46:58 -06:00
const gchar *url,
gpointer data);
2011-11-07 16:52:18 -06:00
gboolean pluma_utils_is_valid_uri (const gchar *uri);
2011-11-07 13:46:58 -06:00
2011-11-07 16:52:18 -06:00
gboolean pluma_utils_get_ui_objects (const gchar *filename,
2011-11-07 13:46:58 -06:00
gchar **root_objects,
GtkWidget **error_widget,
const gchar *object_name,
...) G_GNUC_NULL_TERMINATED;
2011-11-07 16:52:18 -06:00
gboolean pluma_utils_file_has_parent (GFile *gfile);
2011-11-07 13:46:58 -06:00
/* Return NULL if str is not a valid URI and/or filename */
2011-11-07 16:52:18 -06:00
gchar *pluma_utils_make_canonical_uri_from_shell_arg
2011-11-07 13:46:58 -06:00
(const gchar *str);
2011-11-07 16:52:18 -06:00
gchar *pluma_utils_uri_for_display (const gchar *uri);
gchar *pluma_utils_basename_for_display (const gchar *uri);
gboolean pluma_utils_decode_uri (const gchar *uri,
2011-11-07 13:46:58 -06:00
gchar **scheme,
gchar **user,
gchar **port,
gchar **host,
gchar **path);
/* Turns data from a drop into a list of well formatted uris */
2011-11-07 16:52:18 -06:00
gchar **pluma_utils_drop_get_uris (GtkSelectionData *selection_data);
2011-11-07 13:46:58 -06:00
G_END_DECLS
2011-11-07 16:52:18 -06:00
#endif /* __PLUMA_UTILS_H__ */
2011-11-07 13:46:58 -06:00