Commit 7b9f3a31 authored by Marco Trevisan's avatar Marco Trevisan 🎺

Utils: allow to set the default icon sizes and use these values

parent 2142cd2c
......@@ -424,8 +424,6 @@ WnckWorkspaceAccessibleClass
#<FILE>private</FILE>
<SUBSECTION Private>
WNCK_ACTIVATE_TIMEOUT
DEFAULT_ICON_SIZE
DEFAULT_MINI_ICON_SIZE
WNCK_SCREEN_XSCREEN
#</SECTION>
#
......
......@@ -337,18 +337,19 @@ get_icons (WnckApplication *app)
{
GdkPixbuf *icon;
GdkPixbuf *mini_icon;
gsize normal_size;
gsize mini_size;
icon = NULL;
mini_icon = NULL;
normal_size = _wnck_get_default_icon_size ();
mini_size = _wnck_get_default_mini_icon_size ();
if (_wnck_read_icons (WNCK_SCREEN_XSCREEN (app->priv->screen),
app->priv->xwindow,
app->priv->icon_cache,
&icon,
DEFAULT_ICON_SIZE, DEFAULT_ICON_SIZE,
&mini_icon,
DEFAULT_MINI_ICON_SIZE,
DEFAULT_MINI_ICON_SIZE))
&icon, normal_size, normal_size,
&mini_icon, mini_size, mini_size))
{
app->priv->need_emit_icon_changed = TRUE;
app->priv->icon_from_leader = TRUE;
......
......@@ -423,11 +423,11 @@ set_icon (WnckClassGroup *class_group)
if (!icon || !mini_icon)
{
_wnck_get_fallback_icons (&icon,
DEFAULT_ICON_SIZE,
DEFAULT_ICON_SIZE,
_wnck_get_default_icon_size (),
_wnck_get_default_icon_size (),
&mini_icon,
DEFAULT_MINI_ICON_SIZE,
DEFAULT_MINI_ICON_SIZE);
_wnck_get_default_mini_icon_size (),
_wnck_get_default_mini_icon_size ());
icons_reffed = TRUE;
}
......
......@@ -42,6 +42,9 @@ G_BEGIN_DECLS
WnckClientType _wnck_get_client_type (void);
gsize _wnck_get_default_icon_size (void);
gsize _wnck_get_default_mini_icon_size (void);
void _wnck_application_process_property_notify (WnckApplication *app,
XEvent *xevent);
void _wnck_window_process_property_notify (WnckWindow *window,
......@@ -115,9 +118,6 @@ gboolean _wnck_workspace_set_viewport (WnckWorkspace *space, int x, int y);
void _wnck_init (void);
Display *_wnck_get_default_display (void);
#define DEFAULT_ICON_SIZE 32
#define DEFAULT_MINI_ICON_SIZE 16
#define WNCK_SCREEN_XSCREEN(screen) (_wnck_screen_get_xscreen (screen))
Screen *_wnck_screen_get_xscreen (WnckScreen *screen);
......
......@@ -91,7 +91,7 @@ typedef struct _WnckTaskClass WnckTaskClass;
#define DEFAULT_GROUPING_LIMIT 80
#define MINI_ICON_SIZE DEFAULT_MINI_ICON_SIZE
#define MINI_ICON_SIZE _wnck_get_default_mini_icon_size ()
#define TASKLIST_BUTTON_PADDING 4
#define TASKLIST_TEXT_MAX_WIDTH 25 /* maximum width in characters */
......
......@@ -657,6 +657,52 @@ _wnck_get_client_type (void)
return client_type;
}
static gsize default_icon_size = WNCK_DEFAULT_ICON_SIZE;
/**
* wnck_set_default_icon_size:
* @size: the default size for windows and application standard icons.
*
* The default main icon size is %WNCK_DEFAULT_ICON_SIZE. This function allows
* to change this value.
*
* Since: 2.4.6
*/
void
wnck_set_default_icon_size (gsize size)
{
default_icon_size = size;
}
gsize
_wnck_get_default_icon_size (void)
{
return default_icon_size;
}
static gsize default_mini_icon_size = WNCK_DEFAULT_MINI_ICON_SIZE;
/**
* wnck_set_default_mini_icon_size:
* @size: the default size for windows and application mini icons.
*
* The default main icon size is %WNCK_DEFAULT_MINI_ICON_SIZE. This function
* allows to change this value.
*
* Since: 2.4.6
*/
void
wnck_set_default_mini_icon_size (gsize size)
{
default_mini_icon_size = size;
}
gsize
_wnck_get_default_mini_icon_size (void)
{
return default_mini_icon_size;
}
/**
* _make_gtk_label_bold:
* @label: The label.
......
......@@ -104,6 +104,12 @@ typedef enum {
void wnck_set_client_type (WnckClientType ewmh_sourceindication_client_type);
#define WNCK_DEFAULT_ICON_SIZE 32
#define WNCK_DEFAULT_MINI_ICON_SIZE 16
void wnck_set_default_icon_size (gsize size);
void wnck_set_default_mini_icon_size (gsize size);
void wnck_shutdown (void);
void wnck_xid_read_resource_usage (GdkDisplay *gdk_display,
......
......@@ -2100,18 +2100,19 @@ get_icons (WnckWindow *window)
{
GdkPixbuf *icon;
GdkPixbuf *mini_icon;
gsize normal_size;
gsize mini_size;
icon = NULL;
mini_icon = NULL;
normal_size = _wnck_get_default_icon_size ();
mini_size = _wnck_get_default_mini_icon_size ();
if (_wnck_read_icons (WNCK_SCREEN_XSCREEN (window->priv->screen),
window->priv->xwindow,
window->priv->icon_cache,
&icon,
DEFAULT_ICON_SIZE, DEFAULT_ICON_SIZE,
&mini_icon,
DEFAULT_MINI_ICON_SIZE,
DEFAULT_MINI_ICON_SIZE))
&icon, normal_size, normal_size,
&mini_icon, mini_size, mini_size))
{
window->priv->need_emit_icon_changed = TRUE;
......
......@@ -2303,15 +2303,15 @@ _wnck_get_fallback_icons (GdkPixbuf **iconp,
{
if (iconp)
*iconp = default_icon_at_size (ideal_width > 0 ? ideal_width :
DEFAULT_ICON_SIZE,
_wnck_get_default_icon_size (),
ideal_height > 0 ? ideal_height :
DEFAULT_ICON_SIZE);
_wnck_get_default_icon_size ());
if (mini_iconp)
*mini_iconp = default_icon_at_size (ideal_mini_width > 0 ? ideal_mini_width :
DEFAULT_MINI_ICON_SIZE,
_wnck_get_default_mini_icon_size (),
ideal_mini_height > 0 ? ideal_mini_height :
DEFAULT_MINI_ICON_SIZE);
_wnck_get_default_mini_icon_size ());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment