Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
ximper-shell-notification-center
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
ximper-shell-notification-center
Commits
2265b27a
Commit
2265b27a
authored
Nov 28, 2022
by
Erik Reider
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed segfault when reloading config
parent
6b4e6734
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
31 additions
and
22 deletions
+31
-22
controlCenter.vala
src/controlCenter/controlCenter.vala
+3
-4
baseWidget.vala
src/controlCenter/widgets/baseWidget.vala
+9
-10
dnd.vala
src/controlCenter/widgets/dnd/dnd.vala
+2
-1
label.vala
src/controlCenter/widgets/label/label.vala
+4
-2
mpris.vala
src/controlCenter/widgets/mpris/mpris.vala
+4
-2
title.vala
src/controlCenter/widgets/title/title.vala
+7
-3
swayncDaemon.vala
src/swayncDaemon/swayncDaemon.vala
+2
-0
No files found.
src/controlCenter/controlCenter.vala
View file @
2265b27a
...
@@ -148,11 +148,10 @@ namespace SwayNotificationCenter {
...
@@ -148,11 +148,10 @@ namespace SwayNotificationCenter {
/** Adds all custom widgets. Removes previous widgets */
/** Adds all custom widgets. Removes previous widgets */
public
void
add_widgets
()
{
public
void
add_widgets
()
{
// Remove all widgets
// Remove all widgets
while
(
widgets
.
length
>
0
)
{
foreach
(
var
widget
in
widgets
.
data
)
{
uint
i
=
widgets
.
length
-
1
;
box
.
remove
(
widget
);
widgets
.
index
(
i
).
destroy
();
widgets
.
remove_index
(
i
);
}
}
widgets
.
remove_range
(
0
,
widgets
.
length
);
string
[]
w
=
ConfigModel
.
instance
.
widgets
.
data
;
string
[]
w
=
ConfigModel
.
instance
.
widgets
.
data
;
if
(
w
.
length
==
0
)
w
=
DEFAULT_WIDGETS
;
if
(
w
.
length
==
0
)
w
=
DEFAULT_WIDGETS
;
...
...
src/controlCenter/widgets/baseWidget.vala
View file @
2265b27a
...
@@ -39,10 +39,10 @@ namespace SwayNotificationCenter.Widgets {
...
@@ -39,10 +39,10 @@ namespace SwayNotificationCenter.Widgets {
public
virtual
void
on_cc_visibility_change
(
bool
value
)
{}
public
virtual
void
on_cc_visibility_change
(
bool
value
)
{}
protected
void
get_prop
<
T
>
(
Json
.
Object
config
,
string
value_key
,
ref
T
value
)
{
protected
T
?
get_prop
<
T
>
(
Json
.
Object
config
,
string
value_key
)
{
if
(!
config
.
has_member
(
value_key
))
{
if
(!
config
.
has_member
(
value_key
))
{
warnin
g
(
"%s: Config doesn't have key: %s!\n"
,
key
,
value_key
);
debu
g
(
"%s: Config doesn't have key: %s!\n"
,
key
,
value_key
);
return
;
return
null
;
}
}
var
member
=
config
.
get_member
(
value_key
);
var
member
=
config
.
get_member
(
value_key
);
...
@@ -57,18 +57,17 @@ namespace SwayNotificationCenter.Widgets {
...
@@ -57,18 +57,17 @@ namespace SwayNotificationCenter.Widgets {
key
,
key
,
typeof
(
T
).
name
(),
typeof
(
T
).
name
(),
member
.
get_value_type
().
name
());
member
.
get_value_type
().
name
());
return
;
return
null
;
}
}
switch
(
generic_base_type
)
{
switch
(
generic_base_type
)
{
case
Type
.
STRING
:
case
Type
.
STRING
:
value
=
member
.
get_string
();
return
member
.
get_string
();
return
;
case
Type
.
INT64
:
case
Type
.
INT64
:
value
=
member
.
get_int
();
return
(
int
)
member
.
get_int
();
return
;
case
Type
.
BOOLEAN
:
case
Type
.
BOOLEAN
:
value
=
member
.
get_boolean
();
return
member
.
get_boolean
();
return
;
default
:
return
null
;
}
}
}
}
}
}
...
...
src/controlCenter/widgets/dnd/dnd.vala
View file @
2265b27a
...
@@ -18,7 +18,8 @@ namespace SwayNotificationCenter.Widgets {
...
@@ -18,7 +18,8 @@ namespace SwayNotificationCenter.Widgets {
Json
.
Object
?
config
=
get_config
(
this
);
Json
.
Object
?
config
=
get_config
(
this
);
if
(
config
!=
null
)
{
if
(
config
!=
null
)
{
// Get title
// Get title
get_prop
<
string
>
(
config
,
"text"
,
ref
title
);
string
?
title
=
get_prop
<
string
>
(
config
,
"text"
);
if
(
title
!=
null
)
this
.
title
=
title
;
}
}
// Title
// Title
...
...
src/controlCenter/widgets/label/label.vala
View file @
2265b27a
...
@@ -18,9 +18,11 @@ namespace SwayNotificationCenter.Widgets {
...
@@ -18,9 +18,11 @@ namespace SwayNotificationCenter.Widgets {
Json
.
Object
?
config
=
get_config
(
this
);
Json
.
Object
?
config
=
get_config
(
this
);
if
(
config
!=
null
)
{
if
(
config
!=
null
)
{
// Get text
// Get text
get_prop
<
string
>
(
config
,
"text"
,
ref
text
);
string
?
text
=
get_prop
<
string
>
(
config
,
"text"
);
if
(
text
!=
null
)
this
.
text
=
text
;
// Get max lines
// Get max lines
get_prop
<
int
>
(
config
,
"max-lines"
,
ref
max_lines
);
int
?
max_lines
=
get_prop
<
int
>
(
config
,
"max-lines"
);
if
(
max_lines
!=
null
)
this
.
max_lines
=
max_lines
;
}
}
label_widget
=
new
Gtk
.
Label
(
null
);
label_widget
=
new
Gtk
.
Label
(
null
);
...
...
src/controlCenter/widgets/mpris/mpris.vala
View file @
2265b27a
...
@@ -82,10 +82,12 @@ namespace SwayNotificationCenter.Widgets.Mpris {
...
@@ -82,10 +82,12 @@ namespace SwayNotificationCenter.Widgets.Mpris {
Json
.
Object
?
config
=
get_config
(
this
);
Json
.
Object
?
config
=
get_config
(
this
);
if
(
config
!=
null
)
{
if
(
config
!=
null
)
{
// Get image-size
// Get image-size
get_prop
<
int
>
(
config
,
"image-size"
,
ref
mpris_config
.
image_size
);
int
?
image_size
=
get_prop
<
int
>
(
config
,
"image-size"
);
if
(
image_size
!=
null
)
mpris_config
.
image_size
=
image_size
;
// Get image-border-radius
// Get image-border-radius
get_prop
<
int
>
(
config
,
"image-radius"
,
ref
mpris_config
.
image_radius
);
int
?
image_radius
=
get_prop
<
int
>
(
config
,
"image-radius"
);
if
(
image_radius
!=
null
)
mpris_config
.
image_radius
=
image_radius
;
// Clamp the radius
// Clamp the radius
mpris_config
.
image_radius
=
mpris_config
.
image_radius
.
clamp
(
mpris_config
.
image_radius
=
mpris_config
.
image_radius
.
clamp
(
0
,
(
int
)
(
mpris_config
.
image_size
*
0.5
));
0
,
(
int
)
(
mpris_config
.
image_size
*
0.5
));
...
...
src/controlCenter/widgets/title/title.vala
View file @
2265b27a
...
@@ -20,10 +20,14 @@ namespace SwayNotificationCenter.Widgets {
...
@@ -20,10 +20,14 @@ namespace SwayNotificationCenter.Widgets {
Json
.
Object
?
config
=
get_config
(
this
);
Json
.
Object
?
config
=
get_config
(
this
);
if
(
config
!=
null
)
{
if
(
config
!=
null
)
{
// Get title
// Get title
get_prop
<
string
>
(
config
,
"text"
,
ref
title
);
string
?
title
=
get_prop
<
string
>
(
config
,
"text"
);
if
(
title
!=
null
)
this
.
title
=
title
;
// Get has clear-all-button
// Get has clear-all-button
get_prop
<
bool
>
(
config
,
"clear-all-button"
,
ref
has_clear_all_button
);
bool
?
has_clear_all_button
=
get_prop
<
bool
>
(
config
,
"clear-all-button"
);
get_prop
<
string
>
(
config
,
"button-text"
,
ref
button_text
);
if
(
has_clear_all_button
!=
null
)
this
.
has_clear_all_button
=
has_clear_all_button
;
// Get button text
string
?
button_text
=
get_prop
<
string
>
(
config
,
"button-text"
);
if
(
button_text
!=
null
)
this
.
button_text
=
button_text
;
}
}
title_widget
=
new
Gtk
.
Label
(
title
);
title_widget
=
new
Gtk
.
Label
(
title
);
...
...
src/swayncDaemon/swayncDaemon.vala
View file @
2265b27a
...
@@ -153,6 +153,8 @@ namespace SwayNotificationCenter {
...
@@ -153,6 +153,8 @@ namespace SwayNotificationCenter {
/** Reloads the config file */
/** Reloads the config file */
public
void
reload_config
()
throws
Error
{
public
void
reload_config
()
throws
Error
{
print
(
"\n"
);
message
(
"Reloading config\n"
);
ConfigModel
.
reload_config
();
ConfigModel
.
reload_config
();
noti_daemon
.
control_center
.
add_widgets
();
noti_daemon
.
control_center
.
add_widgets
();
}
}
...
...
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