rofi 1.7.9
recursivebrowser.c File Reference
#include "config.h"
#include <errno.h>
#include <gio/gio.h>
#include <gmodule.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <dirent.h>
#include <glib-unix.h>
#include <glib/gstdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "helper.h"
#include "history.h"
#include "mode-private.h"
#include "mode.h"
#include "modes/recursivebrowser.h"
#include "rofi.h"
#include "theme.h"
#include <stdint.h>
#include "rofi-icon-fetcher.h"
Include dependency graph for recursivebrowser.c:

Go to the source code of this file.

Data Structures

struct  FBFile
struct  FileBrowserModePrivateData

Macros

#define G_LOG_DOMAIN   "Modes.RecursiveBrowser"
#define DEFAULT_OPEN   "xdg-open"

Enumerations

enum  FBFileType { UP , DIRECTORY , RFILE , NUM_FILE_TYPES }

Functions

static void free_list (FileBrowserModePrivateData *pd)
static void fb_resize_array (FileBrowserModePrivateData *pd)
static void recursive_browser_mode_init_config (Mode *sw)
static void recursive_browser_mode_init_current_dir (Mode *sw)
static void scan_dir (FileBrowserModePrivateData *pd, GFile *path)
static gpointer recursive_browser_input_thread (gpointer userdata)
static gboolean recursive_browser_async_read_proc (gint fd, GIOCondition condition, gpointer user_data)
static int recursive_browser_mode_init (Mode *sw)
static unsigned int recursive_browser_mode_get_num_entries (const Mode *sw)
static ModeMode recursive_browser_mode_result (Mode *sw, int mretv, G_GNUC_UNUSED char **input, unsigned int selected_line)
static void recursive_browser_mode_destroy (Mode *sw)
static char * _get_display_value (const Mode *sw, unsigned int selected_line, G_GNUC_UNUSED int *state, G_GNUC_UNUSED GList **attr_list, int get_entry)
static int recursive_browser_token_match (const Mode *sw, rofi_int_matcher **tokens, unsigned int index)
static cairo_surface_t * _get_icon (const Mode *sw, unsigned int selected_line, unsigned int height)
static char * _get_message (const Mode *sw)
static char * _get_completion (const Mode *sw, unsigned int index)
Modecreate_new_recursive_browser (void)
ModeMode recursive_browser_mode_completer (Mode *sw, int mretv, char **input, unsigned int selected_line, char **path)

Variables

const char * rb_icon_name [NUM_FILE_TYPES] = {"go-up", "folder", "gtk-file"}
Mode recursive_browser_mode

Macro Definition Documentation

◆ DEFAULT_OPEN

#define DEFAULT_OPEN   "xdg-open"

The default program used to open the file.

Definition at line 56 of file recursivebrowser.c.

◆ G_LOG_DOMAIN

#define G_LOG_DOMAIN   "Modes.RecursiveBrowser"

rofi-recursive_browser

MIT/X11 License Copyright (c) 2017 Qball Cow qball.nosp@m.@gmp.nosp@m.clien.nosp@m.t.or.nosp@m.g

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Definition at line 26 of file recursivebrowser.c.

Enumeration Type Documentation

◆ FBFileType

enum FBFileType

The internal data structure holding the private data of the TEST Mode.

Enumerator
UP 
DIRECTORY 
RFILE 
NUM_FILE_TYPES 

Definition at line 61 of file recursivebrowser.c.

Function Documentation

◆ _get_completion()

char * _get_completion ( const Mode * sw,
unsigned int index )
static

Definition at line 525 of file recursivebrowser.c.

References FileBrowserModePrivateData::array, mode_get_private_data(), and FBFile::path.

Here is the call graph for this function:

◆ _get_display_value()

char * _get_display_value ( const Mode * sw,
unsigned int selected_line,
G_GNUC_UNUSED int * state,
G_GNUC_UNUSED GList ** attr_list,
int get_entry )
static

Definition at line 453 of file recursivebrowser.c.

References FileBrowserModePrivateData::array, FBFile::link, mode_get_private_data(), FBFile::name, FBFile::type, and UP.

Here is the call graph for this function:

◆ _get_icon()

cairo_surface_t * _get_icon ( const Mode * sw,
unsigned int selected_line,
unsigned int height )
static

◆ _get_message()

char * _get_message ( const Mode * sw)
static

Definition at line 512 of file recursivebrowser.c.

References FileBrowserModePrivateData::current_dir, and mode_get_private_data().

Here is the call graph for this function:

◆ fb_resize_array()

void fb_resize_array ( FileBrowserModePrivateData * pd)
inlinestatic

◆ free_list()

void free_list ( FileBrowserModePrivateData * pd)
static

◆ recursive_browser_async_read_proc()

gboolean recursive_browser_async_read_proc ( gint fd,
GIOCondition condition,
gpointer user_data )
static

Definition at line 323 of file recursivebrowser.c.

References FileBrowserModePrivateData::array, FileBrowserModePrivateData::array_length, FileBrowserModePrivateData::async_queue, fb_resize_array(), FileBrowserModePrivateData::loading, and rofi_view_reload().

Referenced by recursive_browser_mode_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ recursive_browser_input_thread()

gpointer recursive_browser_input_thread ( gpointer userdata)
static

Definition at line 311 of file recursivebrowser.c.

References FileBrowserModePrivateData::current_dir, FileBrowserModePrivateData::pipefd2, and scan_dir().

Referenced by recursive_browser_mode_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ recursive_browser_mode_destroy()

◆ recursive_browser_mode_get_num_entries()

unsigned int recursive_browser_mode_get_num_entries ( const Mode * sw)
static

Definition at line 387 of file recursivebrowser.c.

References FileBrowserModePrivateData::array_length, and mode_get_private_data().

Here is the call graph for this function:

◆ recursive_browser_mode_init()

◆ recursive_browser_mode_init_config()

◆ recursive_browser_mode_init_current_dir()

void recursive_browser_mode_init_current_dir ( Mode * sw)
static

Definition at line 161 of file recursivebrowser.c.

References FileBrowserModePrivateData::current_dir, mode_get_private_data(), rofi_mode::name, P_STRING, rofi_config_find_widget(), rofi_theme_find_property(), _PropertyValue::s, Property::type, and Property::value.

Referenced by recursive_browser_mode_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ recursive_browser_mode_result()

◆ recursive_browser_token_match()

int recursive_browser_token_match ( const Mode * sw,
rofi_int_matcher ** tokens,
unsigned int index )
static
Parameters
swThe mode object.
tokensThe tokens to match against.
indexThe index in this plugin to match against.

Match the entry.

Returns
try when a match.

Definition at line 482 of file recursivebrowser.c.

References FileBrowserModePrivateData::array, helper_token_match(), mode_get_private_data(), and FBFile::name.

Here is the call graph for this function:

◆ scan_dir()

Variable Documentation

◆ rb_icon_name

const char* rb_icon_name[NUM_FILE_TYPES] = {"go-up", "folder", "gtk-file"}

Icons to use for the file type

Definition at line 69 of file recursivebrowser.c.

Referenced by _get_icon().