Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Librem5
maynard
Commits
c4bd6363
Commit
c4bd6363
authored
Feb 14, 2014
by
Jonny Lamb
Browse files
app-icon: add new widget subclass for icons on the panel
parent
a3b3d15a
Changes
3
Hide whitespace changes
Inline
Side-by-side
shell/Makefile.am
View file @
c4bd6363
...
...
@@ -11,6 +11,8 @@ external_sources = \
weston_gtk_shell_SOURCES
=
\
gtk-shell.c
\
app-icon.c
\
app-icon.h
\
app-launcher.c
\
app-launcher.h
\
clock.c
\
...
...
shell/app-icon.c
0 → 100644
View file @
c4bd6363
/*
* Copyright (C) 2014 Collabora Ltd.
*
* Author: Jonny Lamb <jonny.lamb@collabora.co.uk>
*/
#include "config.h"
#include "app-icon.h"
G_DEFINE_TYPE
(
WestonGtkAppIcon
,
weston_gtk_app_icon
,
GTK_TYPE_BUTTON
)
static
void
weston_gtk_app_icon_init
(
WestonGtkAppIcon
*
self
)
{
gtk_style_context_add_class
(
gtk_widget_get_style_context
(
GTK_WIDGET
(
self
)),
"wgs-apps"
);
gtk_style_context_remove_class
(
gtk_widget_get_style_context
(
GTK_WIDGET
(
self
)),
"button"
);
gtk_style_context_remove_class
(
gtk_widget_get_style_context
(
GTK_WIDGET
(
self
)),
"image-button"
);
gtk_button_set_relief
(
GTK_BUTTON
(
self
),
GTK_RELIEF_NONE
);
}
static
void
weston_gtk_app_icon_class_init
(
WestonGtkAppIconClass
*
klass
)
{
}
GtkWidget
*
weston_gtk_app_icon_new
(
const
gchar
*
icon_name
)
{
GtkWidget
*
widget
;
GtkWidget
*
image
;
image
=
gtk_image_new_from_icon_name
(
icon_name
,
GTK_ICON_SIZE_DIALOG
);
widget
=
g_object_new
(
WESTON_GTK_APP_ICON_TYPE
,
"image"
,
image
,
NULL
);
return
widget
;
}
GtkWidget
*
weston_gtk_app_icon_new_from_gicon
(
GIcon
*
icon
)
{
GtkWidget
*
widget
,
*
image
;
image
=
gtk_image_new_from_gicon
(
icon
,
GTK_ICON_SIZE_DIALOG
);
widget
=
g_object_new
(
WESTON_GTK_APP_ICON_TYPE
,
"image"
,
image
,
NULL
);
return
widget
;
}
shell/app-icon.h
0 → 100644
View file @
c4bd6363
/*
* Copyright (C) 2014 Collabora Ltd.
*
* Author: Jonny Lamb <jonny.lamb@collabora.co.uk>
*/
#ifndef __WESTON_GTK_APP_ICON_H__
#define __WESTON_GTK_APP_ICON_H__
#include <gtk/gtk.h>
#define WESTON_GTK_APP_ICON_TYPE (weston_gtk_app_icon_get_type ())
#define WESTON_GTK_APP_ICON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WESTON_GTK_APP_ICON_TYPE, WestonGtkAppIcon))
#define WESTON_GTK_APP_ICON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), WESTON_GTK_APP_ICON_TYPE, WestonGtkAppIconClass))
#define WESTON_GTK_IS_APP_ICON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WESTON_GTK_APP_ICON_TYPE))
#define WESTON_GTK_IS_APP_ICON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), WESTON_GTK_APP_ICON_TYPE))
#define WESTON_GTK_APP_ICON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), WESTON_GTK_APP_ICON_TYPE, WestonGtkAppIconClass))
typedef
struct
WestonGtkAppIcon
WestonGtkAppIcon
;
typedef
struct
WestonGtkAppIconClass
WestonGtkAppIconClass
;
typedef
struct
WestonGtkAppIconPrivate
WestonGtkAppIconPrivate
;
struct
WestonGtkAppIcon
{
GtkButton
parent
;
WestonGtkAppIconPrivate
*
priv
;
};
struct
WestonGtkAppIconClass
{
GtkButtonClass
parent_class
;
};
GType
weston_gtk_app_icon_get_type
(
void
)
G_GNUC_CONST
;
GtkWidget
*
weston_gtk_app_icon_new
(
const
gchar
*
icon_name
);
GtkWidget
*
weston_gtk_app_icon_new_from_gicon
(
GIcon
*
icon
);
#endif
/* __WESTON_GTK_APP_ICON_H__ */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment