pidgin  2.13.0
About: Pidgin is a chat program (multi-protocol instant messaging client) which lets you log in to accounts on multiple chat networks simultaneously (old name "gaim").
  Fossies Dox: pidgin-2.13.0.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

gntfilesel.c File Reference
#include "gntinternal.h"
#include "gntbutton.h"
#include "gntentry.h"
#include "gntfilesel.h"
#include "gntlabel.h"
#include "gntmarshal.h"
#include "gntstyle.h"
#include "gnttree.h"
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
Include dependency graph for gntfilesel.c:

Go to the source code of this file.

Macros

#define GNT_LOG_DOMAIN   "FileSel"
 

Enumerations

enum  { SIG_FILE_SELECTED, SIGS }
 

Functions

static void select_activated_cb (GntWidget *button, GntFileSel *sel)
 
static void gnt_file_sel_destroy (GntWidget *widget)
 
static gchar * g_build_path_va (const gchar *separator, gchar **str_array)
 
static gchar * g_build_pathv (const gchar *separator, gchar **args)
 
static char * process_path (const char *path)
 
static void update_location (GntFileSel *sel)
 
static gboolean is_tagged (GntFileSel *sel, const char *f)
 
GntFilegnt_file_new_dir (const char *name)
 
GntFilegnt_file_new (const char *name, unsigned long size)
 
static gboolean local_read_fn (const char *path, GList **files, GError **error)
 
static void gnt_file_free (GntFile *file)
 
static gboolean location_changed (GntFileSel *sel, GError **err)
 
static gboolean dir_key_pressed (GntTree *tree, const char *key, GntFileSel *sel)
 
static gboolean location_key_pressed (GntTree *tree, const char *key, GntFileSel *sel)
 
static void file_sel_changed (GntWidget *widget, gpointer old, gpointer current, GntFileSel *sel)
 
static void gnt_file_sel_map (GntWidget *widget)
 
static gboolean toggle_tag_selection (GntBindable *bind, GList *null)
 
static gboolean clear_tags (GntBindable *bind, GList *null)
 
static gboolean up_directory (GntBindable *bind, GList *null)
 
static void gnt_file_sel_size_request (GntWidget *widget)
 
static void gnt_file_sel_class_init (GntFileSelClass *klass)
 
static void gnt_file_sel_init (GTypeInstance *instance, gpointer class)
 
GType gnt_file_sel_get_gtype (void)
 
GntWidgetgnt_file_sel_new (void)
 
gboolean gnt_file_sel_set_current_location (GntFileSel *sel, const char *path)
 
void gnt_file_sel_set_dirs_only (GntFileSel *sel, gboolean dirs)
 
gboolean gnt_file_sel_get_dirs_only (GntFileSel *sel)
 
void gnt_file_sel_set_suggested_filename (GntFileSel *sel, const char *suggest)
 
char * gnt_file_sel_get_selected_file (GntFileSel *sel)
 
void gnt_file_sel_set_must_exist (GntFileSel *sel, gboolean must)
 
gboolean gnt_file_sel_get_must_exist (GntFileSel *sel)
 
void gnt_file_sel_set_multi_select (GntFileSel *sel, gboolean set)
 
GList * gnt_file_sel_get_selected_multi_files (GntFileSel *sel)
 
void gnt_file_sel_set_read_fn (GntFileSel *sel, gboolean(*read_fn)(const char *path, GList **files, GError **error))
 

Variables

static GntWindowClassparent_class = NULL
 
static guint signals [SIGS] = { 0 }
 
static void(* orig_map )(GntWidget *widget)
 
static void(* orig_size_request )(GntWidget *widget)
 

Macro Definition Documentation

◆ GNT_LOG_DOMAIN

#define GNT_LOG_DOMAIN   "FileSel"

GNT - The GLib Ncurses Toolkit

GNT is the legal property of its developers, whose names are too numerous to list here. Please refer to the COPYRIGHT file distributed with this source distribution.

This library 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 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA

Definition at line 25 of file gntfilesel.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
SIG_FILE_SELECTED 
SIGS 

Definition at line 44 of file gntfilesel.c.

Function Documentation

◆ clear_tags()

◆ dir_key_pressed()

static gboolean dir_key_pressed ( GntTree tree,
const char *  key,
GntFileSel sel 
)
static

◆ file_sel_changed()

static void file_sel_changed ( GntWidget widget,
gpointer  old,
gpointer  current,
GntFileSel sel 
)
static

◆ g_build_path_va()

static gchar* g_build_path_va ( const gchar *  separator,
gchar **  str_array 
)
static

Definition at line 72 of file gntfilesel.c.

References FALSE, NULL, and TRUE.

Referenced by g_build_pathv().

◆ g_build_pathv()

static gchar* g_build_pathv ( const gchar *  separator,
gchar **  args 
)
static

Definition at line 158 of file gntfilesel.c.

References dbus-analyze-signals::args, g_build_path_va(), and NULL.

Referenced by process_path().

◆ gnt_file_free()

static void gnt_file_free ( GntFile file)
static

Definition at line 283 of file gntfilesel.c.

References file.

Referenced by location_changed().

◆ gnt_file_new()

GntFile* gnt_file_new ( const char *  name,
unsigned long  size 
)

Create a new GntFile.

Parameters
nameThe name of the file.
sizeThe size of the file.
Returns
The newly created GntFile.

Definition at line 233 of file gntfilesel.c.

References file, GNT_FILE_REGULAR, and name.

Referenced by local_read_fn().

◆ gnt_file_new_dir()

GntFile* gnt_file_new_dir ( const char *  name)

Create a new GntFile for a directory.

Parameters
nameThe name of the directory.
Returns
The newly created GntFile.

Definition at line 225 of file gntfilesel.c.

References file, GNT_FILE_DIR, and name.

Referenced by local_read_fn().

◆ gnt_file_sel_class_init()

◆ gnt_file_sel_destroy()

static void gnt_file_sel_destroy ( GntWidget widget)
static

◆ gnt_file_sel_get_dirs_only()

gboolean gnt_file_sel_get_dirs_only ( GntFileSel sel)

Check whether the file selector allows only selecting directories.

Parameters
selThe file selector.
Returns
TRUE if only directories can be selected.

Definition at line 724 of file gntfilesel.c.

References _GntFileSel::dirsonly.

◆ gnt_file_sel_get_gtype()

GType gnt_file_sel_get_gtype ( void  )
Returns
GType for GntFileSel.

Definition at line 654 of file gntfilesel.c.

References gnt_file_sel_class_init(), gnt_file_sel_init(), GNT_TYPE_WINDOW, info, NULL, and dbus-analyze-signals::type.

◆ gnt_file_sel_get_must_exist()

gboolean gnt_file_sel_get_must_exist ( GntFileSel sel)

Check whether the selector allows selecting non-existent files.

Parameters
selThe file selector.
Returns
TRUE if the selected file must exist, FALSE if a non-existent file can be selected.

Definition at line 752 of file gntfilesel.c.

References _GntFileSel::must_exist.

◆ gnt_file_sel_get_selected_file()

char* gnt_file_sel_get_selected_file ( GntFileSel sel)

Get the selected file in the selector.

Parameters
selThe file selector.
Returns
The path of the selected file. The caller should g_free the returned string.

Definition at line 735 of file gntfilesel.c.

References _GntFileSel::dirsonly, GNT_ENTRY, gnt_entry_get_text(), and _GntFileSel::location.

Referenced by file_ok_cb(), gnt_file_sel_get_selected_multi_files(), select_activated_cb(), and toggle_tag_selection().

◆ gnt_file_sel_get_selected_multi_files()

GList* gnt_file_sel_get_selected_multi_files ( GntFileSel sel)

Get the list of selected files in the selector.

Parameters
selThe file selector.
Returns
A list of paths for the selected files. The caller must g_free the contents of the list, and g_list_free the list.

Definition at line 762 of file gntfilesel.c.

References gnt_file_sel_get_selected_file(), NULL, str, and _GntFileSel::tags.

◆ gnt_file_sel_init()

◆ gnt_file_sel_map()

◆ gnt_file_sel_new()

GntWidget* gnt_file_sel_new ( void  )

Create a new file selector.

Returns
The newly created file selector.

Definition at line 691 of file gntfilesel.c.

References GNT_TYPE_FILE_SEL, NULL, and widget.

Referenced by choose_cb(), dump_screen(), finch_file_request_window(), and save_debug_win().

◆ gnt_file_sel_set_current_location()

gboolean gnt_file_sel_set_current_location ( GntFileSel sel,
const char *  path 
)

Set the current location of the file selector.

Parameters
selThe file selector.
pathThe current path of the selector.
Returns
TRUE if the current location was successfully changed, FALSE otherwise.

Definition at line 697 of file gntfilesel.c.

References _GntFileSel::current, error, FALSE, location_changed(), NULL, pietray::path, process_path(), TRUE, and update_location().

Referenced by choose_cb(), dir_key_pressed(), finch_file_request_window(), gnt_file_sel_map(), location_key_pressed(), save_debug_win(), and up_directory().

◆ gnt_file_sel_set_dirs_only()

void gnt_file_sel_set_dirs_only ( GntFileSel sel,
gboolean  dirs 
)

Set wheter to only allow selecting directories.

Parameters
selThe file selector.
dirsTRUE if only directories can be selected, FALSE if files can also be selected.

Definition at line 719 of file gntfilesel.c.

References _GntFileSel::dirsonly.

Referenced by finch_request_folder().

◆ gnt_file_sel_set_multi_select()

void gnt_file_sel_set_multi_select ( GntFileSel sel,
gboolean  set 
)

Allow selecting multiple files.

Parameters
selThe file selector.
setTRUE if selecting multiple files should be allowed.

Definition at line 757 of file gntfilesel.c.

References _GntFileSel::multiselect, and set().

◆ gnt_file_sel_set_must_exist()

void gnt_file_sel_set_must_exist ( GntFileSel sel,
gboolean  must 
)

Set whether a selected file must exist.

Parameters
selThe file selector.
mustTRUE if the selected file must exist.

Definition at line 746 of file gntfilesel.c.

References _GntFileSel::must_exist.

◆ gnt_file_sel_set_read_fn()

void gnt_file_sel_set_read_fn ( GntFileSel sel,
gboolean(*)(const char *path, GList **files, GError **error read_fn 
)

Set custom functions to read the names of files.

Parameters
selThe file selector.
read_fnThe custom read function.

Definition at line 780 of file gntfilesel.c.

References _GntFileSel::read_fn.

◆ gnt_file_sel_set_suggested_filename()

void gnt_file_sel_set_suggested_filename ( GntFileSel sel,
const char *  suggest 
)

Set the suggested file to have selected at startup.

Parameters
selThe file selector.
suggestThe suggested filename.

Definition at line 729 of file gntfilesel.c.

References _GntFileSel::suggest.

Referenced by dump_screen(), finch_request_file(), and save_debug_win().

◆ gnt_file_sel_size_request()

static void gnt_file_sel_size_request ( GntWidget widget)
static

◆ is_tagged()

static gboolean is_tagged ( GntFileSel sel,
const char *  f 
)
static

Definition at line 217 of file gntfilesel.c.

References _GntFileSel::current, NULL, and _GntFileSel::tags.

Referenced by location_changed().

◆ local_read_fn()

static gboolean local_read_fn ( const char *  path,
GList **  files,
GError **  error 
)
static

Definition at line 243 of file gntfilesel.c.

References error, FALSE, file, gnt_file_new(), gnt_file_new_dir(), gnt_warning, NULL, pietray::path, S_ISDIR, str, and TRUE.

Referenced by location_changed().

◆ location_changed()

◆ location_key_pressed()

◆ process_path()

static char* process_path ( const char *  path)
static

Definition at line 170 of file gntfilesel.c.

References g_build_pathv(), NULL, pietray::path, and str.

Referenced by gnt_file_sel_set_current_location(), and location_key_pressed().

◆ select_activated_cb()

static void select_activated_cb ( GntWidget button,
GntFileSel sel 
)
static

Definition at line 682 of file gntfilesel.c.

References file, gnt_file_sel_get_selected_file(), pietray::path, SIG_FILE_SELECTED, and signals.

Referenced by gnt_file_sel_init().

◆ toggle_tag_selection()

◆ up_directory()

◆ update_location()

Variable Documentation

◆ orig_map

void(* orig_map) (GntWidget *widget)
static

Definition at line 52 of file gntfilesel.c.

Referenced by gnt_file_sel_class_init(), and gnt_file_sel_map().

◆ orig_size_request

void(* orig_size_request) (GntWidget *widget)
static

Definition at line 53 of file gntfilesel.c.

Referenced by gnt_file_sel_class_init(), and gnt_file_sel_size_request().

◆ parent_class

GntWindowClass* parent_class = NULL
static

Definition at line 50 of file gntfilesel.c.

Referenced by gnt_file_sel_class_init().

◆ signals

guint signals[SIGS] = { 0 }
static

Definition at line 51 of file gntfilesel.c.

Referenced by gnt_file_sel_class_init(), and select_activated_cb().