mirror of
https://github.com/davatorium/rofi.git
synced 2025-11-06 22:54:53 -05:00
[Mode] Remove the old _get_icon method
This commit is contained in:
parent
e8cc9e0b23
commit
0f9750814b
3 changed files with 5 additions and 71 deletions
|
|
@ -69,19 +69,6 @@ typedef char *(*_mode_get_display_value)(const Mode *sw,
|
|||
unsigned int selected_line, int *state,
|
||||
GList **attribute_list, int get_entry);
|
||||
|
||||
/**
|
||||
* @param sw The #Mode pointer
|
||||
* @param selected_line The selected line
|
||||
* @param height The height of the icon
|
||||
*
|
||||
* Obtains the icon if available
|
||||
*
|
||||
* @return Get the icon
|
||||
*/
|
||||
typedef cairo_surface_t *(*_mode_get_icon)(const Mode *sw,
|
||||
unsigned int selected_line,
|
||||
unsigned int height);
|
||||
|
||||
/**
|
||||
* @param sw The #Mode pointer
|
||||
* @param selected_line The selected line
|
||||
|
|
@ -91,7 +78,7 @@ typedef cairo_surface_t *(*_mode_get_icon)(const Mode *sw,
|
|||
* @return Get an array of icon names
|
||||
*/
|
||||
typedef char **(*_mode_get_icon_names)(const Mode *sw,
|
||||
unsigned int selected_line);
|
||||
unsigned int selected_line);
|
||||
/**
|
||||
* @param sw The #Mode pointer
|
||||
* @param selected_line The selected line
|
||||
|
|
@ -225,7 +212,6 @@ struct rofi_mode {
|
|||
/** Get the string to display for the entry. */
|
||||
_mode_get_display_value _get_display_value;
|
||||
/** Get the icon for the entry. */
|
||||
_mode_get_icon _get_icon;
|
||||
_mode_get_icon_names _get_icon_names;
|
||||
/** Get the 'completed' entry. */
|
||||
_mode_get_completion _get_completion;
|
||||
|
|
|
|||
|
|
@ -88,45 +88,11 @@ char **mode_get_icon_names(Mode *mode, unsigned int selected_line) {
|
|||
g_assert(mode != NULL);
|
||||
|
||||
if (mode->_get_icon_names != NULL) {
|
||||
return mode->_get_icon_names (mode, selected_line);
|
||||
return mode->_get_icon_names(mode, selected_line);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cairo_surface_t *mode_get_icon(Mode *mode, unsigned int selected_line,
|
||||
unsigned int height) {
|
||||
g_assert(mode != NULL);
|
||||
|
||||
if (mode->_get_icon != NULL) {
|
||||
cairo_surface_t *icon = mode->_get_icon(mode, selected_line, height);
|
||||
if (icon) {
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
|
||||
if (mode->fallback_icon_not_found == TRUE) {
|
||||
return NULL;
|
||||
}
|
||||
if (mode->fallback_icon_fetch_uid > 0) {
|
||||
cairo_surface_t *icon =
|
||||
rofi_icon_fetcher_get(mode->fallback_icon_fetch_uid);
|
||||
return icon;
|
||||
}
|
||||
ThemeWidget *wid = rofi_config_find_widget(mode->name, NULL, TRUE);
|
||||
if (wid) {
|
||||
/** Load user entires */
|
||||
Property *p =
|
||||
rofi_theme_find_property(wid, P_STRING, "fallback-icon", TRUE);
|
||||
if (p != NULL && (p->type == P_STRING && p->value.s)) {
|
||||
mode->fallback_icon_fetch_uid =
|
||||
rofi_icon_fetcher_query(p->value.s, height);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
mode->fallback_icon_not_found = TRUE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *mode_get_completion(const Mode *mode, unsigned int selected_line) {
|
||||
g_assert(mode != NULL);
|
||||
if (mode->_get_completion != NULL) {
|
||||
|
|
@ -259,10 +225,6 @@ gboolean mode_is_completer(const Mode *mode) {
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
void mode_plugin_set_module(Mode *mode, GModule *mod){
|
||||
mode->module = mod;
|
||||
}
|
||||
GModule *mode_plugin_get_module(Mode *mode){
|
||||
return mode->module;
|
||||
}
|
||||
void mode_plugin_set_module(Mode *mode, GModule *mod) { mode->module = mod; }
|
||||
GModule *mode_plugin_get_module(Mode *mode) { return mode->module; }
|
||||
/**@}*/
|
||||
|
|
|
|||
|
|
@ -296,19 +296,6 @@ static char **combi_get_icon_names(const Mode *sw, unsigned int index) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static cairo_surface_t *combi_get_icon(const Mode *sw, unsigned int index,
|
||||
unsigned int height) {
|
||||
CombiModePrivateData *pd = mode_get_private_data(sw);
|
||||
for (unsigned i = 0; i < pd->num_switchers; i++) {
|
||||
if (index >= pd->starts[i] && index < (pd->starts[i] + pd->lengths[i])) {
|
||||
cairo_surface_t *icon =
|
||||
mode_get_icon(pd->switchers[i].mode, index - pd->starts[i], height);
|
||||
return icon;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char *combi_preprocess_input(Mode *sw, const char *input) {
|
||||
CombiModePrivateData *pd = mode_get_private_data(sw);
|
||||
for (unsigned i = 0; i < pd->num_switchers; i++) {
|
||||
|
|
@ -350,8 +337,7 @@ Mode combi_mode = {.name = "combi",
|
|||
._token_match = combi_mode_match,
|
||||
._get_completion = combi_get_completion,
|
||||
._get_display_value = combi_mgrv,
|
||||
._get_icon = combi_get_icon,
|
||||
._get_icon_names = combi_get_icon_names ,
|
||||
._get_icon_names = combi_get_icon_names,
|
||||
._preprocess_input = combi_preprocess_input,
|
||||
.private_data = NULL,
|
||||
.free = NULL,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue