Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Icon Library
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
10
Issues
10
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
World
Design Tooling
Icon Library
Commits
0c63b14b
Commit
0c63b14b
authored
Jul 23, 2019
by
Bilal Elmoussaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor cleaning
parent
105844d3
Pipeline
#98183
passed with stages
in 22 minutes and 23 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
19 deletions
+25
-19
src/widgets/export.rs
src/widgets/export.rs
+9
-3
src/widgets/icons.rs
src/widgets/icons.rs
+16
-16
No files found.
src/widgets/export.rs
View file @
0c63b14b
use
crate
::
icon
::
Icon
;
use
gdk
;
use
gettextrs
::
gettext
;
use
gio
::
prelude
::
*
;
use
gtk
;
use
gtk
::
prelude
::
*
;
...
...
@@ -16,7 +16,7 @@ pub struct ExportDialog {
}
impl
ExportDialog
{
pub
fn
new
(
icon
:
Icon
)
->
ExportDialog
{
pub
fn
new
(
icon
:
&
Icon
)
->
ExportDialog
{
let
builder
=
gtk
::
Builder
::
new_from_resource
(
"/org/gnome/design/IconLibrary/export_dialog.ui"
);
let
widget
:
libhandy
::
Dialog
=
builder
.get_object
(
"export_dialog"
)
.unwrap
();
...
...
@@ -68,7 +68,13 @@ impl ExportDialog {
let
save_as
=
gio
::
SimpleAction
::
new
(
"save-as"
,
None
);
let
window
=
self
.widget
.clone
();
save_as
.connect_activate
(
move
|
_
,
_
|
{
let
export_dialog
=
gtk
::
FileChooserNative
::
new
(
Some
(
"Export a symbolic icon"
),
Some
(
&
window
),
gtk
::
FileChooserAction
::
Save
,
Some
(
"Export"
),
Some
(
"Cancel"
));
let
export_dialog
=
gtk
::
FileChooserNative
::
new
(
Some
(
gettext
(
"Export a symbolic icon"
)
.as_str
()),
Some
(
&
window
),
gtk
::
FileChooserAction
::
Save
,
Some
(
gettext
(
"Export"
)
.as_str
()),
Some
(
gettext
(
"Cancel"
)
.as_str
()),
);
let
file_name
=
format!
(
"{}.svg"
,
icon_name
.clone
());
export_dialog
.set_current_name
(
Path
::
new
(
&
file_name
));
let
icon_name
=
icon_name
.clone
();
...
...
src/widgets/icons.rs
View file @
0c63b14b
...
...
@@ -175,14 +175,10 @@ impl IconsViewContext {
}
fn
init
(
&
self
)
{
self
.widget
.set_valign
(
gtk
::
Align
::
Fill
);
self
.widget
.set_halign
(
gtk
::
Align
::
Fill
);
self
.icons_container
.set_valign
(
gtk
::
Align
::
Fill
);
self
.icons_container
.set_halign
(
gtk
::
Align
::
Fill
);
self
.icons_container
.set_row_spacing
(
12
);
self
.icons_container
.set_column_spacing
(
12
);
self
.icons_container
.set_max_children_per_line
(
14
);
self
.icons_container
.set_min_children_per_line
(
6
);
self
.icons_container
.set_selection_mode
(
gtk
::
SelectionMode
::
None
);
let
context_label
=
gtk
::
Label
::
new
(
Some
(
self
.context
.as_str
()));
...
...
@@ -203,13 +199,15 @@ impl IconsViewContext {
fn
connect_signals
(
&
self
,
parent
:
&
gtk
::
ApplicationWindow
)
{
let
parent_window
=
parent
.clone
();
let
icons_views
=
self
.icons_views
.clone
();
self
.icons_container
.connect_child_activated
(
move
|
_
,
child
|
match
icons_views
.get
(
child
)
{
Some
(
icon
)
=>
{
let
export_dialog
=
ExportDialog
::
new
(
icon
.clone
());
export_dialog
.widget
.set_transient_for
(
Some
(
&
parent_window
));
export_dialog
.widget
.show_all
();
}
None
=>
println!
(
"Couldn't find the icon"
),
self
.icons_container
.connect_child_activated
(
move
|
_
,
child
|
{
match
icons_views
.get
(
child
)
{
Some
(
icon
)
=>
{
let
export_dialog
=
ExportDialog
::
new
(
icon
);
export_dialog
.widget
.set_transient_for
(
Some
(
&
parent_window
));
export_dialog
.widget
.show_all
();
}
None
=>
error!
(
"Export Dialog: Couldn't find the icon"
),
};
});
}
...
...
@@ -219,7 +217,10 @@ impl IconsViewContext {
let
filter_closure
=
move
|
child
:
&
gtk
::
FlowBoxChild
|
->
bool
{
match
icons_views
.get
(
child
)
{
Some
(
icon
)
=>
icon
.should_display
(
&
search_str
),
None
=>
false
,
None
=>
{
error!
(
"Search: couldn't find the icon"
);
false
}
}
};
self
.icons_container
.set_filter_func
(
Some
(
Box
::
new
(
filter_closure
)));
...
...
@@ -231,10 +232,9 @@ impl IconsViewContext {
self
.widget
.set_visible
(
self
.n_last_search_results
!=
0
);
}
}
#[derive(Clone)]
struct
IconView
{
pub
widget
:
gtk
::
FlowBoxChild
,
icon
:
Icon
,
}
impl
IconView
{
...
...
@@ -247,7 +247,7 @@ impl IconView {
widget
.set_tooltip_text
(
Some
(
icon_name
));
widget
.add
(
&
icon_img
);
let
icon_view
=
IconView
{
widget
,
icon
};
let
icon_view
=
IconView
{
widget
};
icon_view
}
}
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