mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-25 13:55:34 -05:00
Slowly move more settings to the configuration convert.
This commit is contained in:
parent
44534653bf
commit
7d16d1a552
7 changed files with 41 additions and 12 deletions
|
@ -400,16 +400,44 @@ void rofi_theme_convert_old_theme ( void )
|
|||
rofi_theme = (Widget*)g_malloc0 ( sizeof ( Widget ) );
|
||||
rofi_theme->name = g_strdup ( "Root" );
|
||||
rofi_theme->properties = rofi_theme_convert_create_property_ht ( );
|
||||
{
|
||||
// Spacing
|
||||
Widget *box_widget = rofi_theme_find_or_create_class ( rofi_theme , "@box" );
|
||||
box_widget->properties = rofi_theme_convert_create_property_ht ( );
|
||||
Property *p = rofi_theme_property_create ( P_INTEGER );
|
||||
p->name = g_strdup("spacing");
|
||||
p->value.i = config.padding;
|
||||
g_hash_table_replace ( box_widget->properties, p->name, p );
|
||||
}
|
||||
{
|
||||
// Spacing
|
||||
Widget *listview_widget = rofi_theme_find_or_create_class ( rofi_theme , "@listview" );
|
||||
listview_widget->properties = rofi_theme_convert_create_property_ht ( );
|
||||
Property *p = rofi_theme_property_create ( P_INTEGER );
|
||||
p->name = g_strdup("spacing");
|
||||
p->value.i = config.padding;
|
||||
g_hash_table_replace ( listview_widget->properties, p->name, p );
|
||||
}
|
||||
{
|
||||
// Border width.
|
||||
Widget *window_widget = rofi_theme_find_or_create_class ( rofi_theme , "@window" );
|
||||
window_widget->properties = rofi_theme_convert_create_property_ht ( );
|
||||
Property *p = rofi_theme_property_create ( P_INTEGER );
|
||||
p->name = g_strdup("border-width");
|
||||
p->value.i = config.menu_bw;
|
||||
g_hash_table_replace ( window_widget->properties, p->name, p );
|
||||
// Padding
|
||||
p = rofi_theme_property_create ( P_INTEGER );
|
||||
p->name = g_strdup("padding");
|
||||
p->value.i = config.padding;
|
||||
g_hash_table_replace ( window_widget->properties, p->name, p );
|
||||
}
|
||||
{
|
||||
gchar **vals = g_strsplit ( config.color_window, ",", 3 );
|
||||
if ( vals != NULL ){
|
||||
if ( vals[0] != NULL ) {
|
||||
Property *p = rofi_theme_convert_get_color ( vals[0], "background" );
|
||||
g_hash_table_replace ( rofi_theme->properties, p->name, p );
|
||||
p = rofi_theme_property_create ( P_INTEGER );
|
||||
p->name = g_strdup("padding");
|
||||
p->value.i = config.padding;
|
||||
g_hash_table_replace ( rofi_theme->properties, p->name, p );
|
||||
|
||||
if ( vals[1] != NULL ) {
|
||||
p = rofi_theme_convert_get_color ( vals[1], "foreground" );
|
||||
|
|
|
@ -30,11 +30,12 @@
|
|||
#include "widgets/widget-internal.h"
|
||||
#include "widgets/box.h"
|
||||
#include "theme.h"
|
||||
#include "settings.h"
|
||||
|
||||
#define LOG_DOMAIN "Widgets.Box"
|
||||
const char *BOX_CLASS_NAME = "@box";
|
||||
|
||||
#define DEFAULT_SPACING 2
|
||||
|
||||
/**
|
||||
* @param box Handle to the box widget.
|
||||
* @param spacing The spacing to apply.
|
||||
|
@ -351,7 +352,7 @@ box * box_create ( const char *name, boxType type )
|
|||
b->widget.get_desired_height = box_get_desired_height;
|
||||
b->widget.enabled = TRUE;
|
||||
|
||||
box_set_spacing ( b, distance_get_pixel (rofi_theme_get_distance ( b->widget.class_name, b->widget.name, NULL, "spacing",config.line_margin )));
|
||||
box_set_spacing ( b, distance_get_pixel (rofi_theme_get_distance ( b->widget.class_name, b->widget.name, NULL, "spacing",DEFAULT_SPACING )));
|
||||
return b;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
#include "settings.h"
|
||||
#include "theme.h"
|
||||
|
||||
#define DEFAULT_SPACING 2
|
||||
|
||||
struct _listview
|
||||
{
|
||||
widget widget;
|
||||
|
@ -349,7 +351,7 @@ listview *listview_create ( const char *name, listview_update_callback cb, void
|
|||
lv->udata = udata;
|
||||
|
||||
// Some settings.
|
||||
lv->spacing = distance_get_pixel (rofi_theme_get_distance (lv->widget.class_name, lv->widget.name, NULL, "spacing", config.line_margin ));
|
||||
lv->spacing = distance_get_pixel (rofi_theme_get_distance (lv->widget.class_name, lv->widget.name, NULL, "spacing", DEFAULT_SPACING ));
|
||||
lv->menu_lines = rofi_theme_get_integer (lv->widget.class_name, lv->widget.name, NULL, "lines", config.menu_lines );
|
||||
lv->menu_columns = rofi_theme_get_integer (lv->widget.class_name, lv->widget.name, NULL, "columns", config.menu_columns);
|
||||
lv->fixed_num_lines = rofi_theme_get_boolean (lv->widget.class_name, lv->widget.name, NULL, "fixed-height", config.fixed_num_lines );
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include <glib.h>
|
||||
#include "widgets/scrollbar.h"
|
||||
#include "x11-helper.h"
|
||||
#include "settings.h"
|
||||
|
||||
#include "theme.h"
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "widgets/widget-internal.h"
|
||||
#include "widgets/separator.h"
|
||||
#include "x11-helper.h"
|
||||
#include "settings.h"
|
||||
#include "theme.h"
|
||||
|
||||
const char *SEPARATOR_CLASS_NAME = "@separator";
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include <string.h>
|
||||
#include <glib.h>
|
||||
#include <math.h>
|
||||
#include "settings.h"
|
||||
#include "widgets/textbox.h"
|
||||
#include "keyb.h"
|
||||
#include "x11-helper.h"
|
||||
|
|
|
@ -30,9 +30,10 @@
|
|||
#include "widgets/widget-internal.h"
|
||||
#include "widgets/window.h"
|
||||
#include "theme.h"
|
||||
#include "settings.h"
|
||||
|
||||
#define LOG_DOMAIN "Widgets.Window"
|
||||
|
||||
#define DEFAULT_BORDER_WIDTH 2
|
||||
const char *WINDOW_CLASS_NAME = "@window";
|
||||
|
||||
/**
|
||||
|
@ -147,7 +148,7 @@ window * window_create ( const char *name )
|
|||
b->widget.get_desired_height = window_get_desired_height;
|
||||
b->widget.enabled = TRUE;
|
||||
b->border_width = rofi_theme_get_integer (
|
||||
b->widget.class_name, b->widget.name, NULL, "border-width" , config.menu_bw);
|
||||
b->widget.class_name, b->widget.name, NULL, "border-width" , DEFAULT_BORDER_WIDTH);
|
||||
|
||||
return b;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue