Skip to content

Commit 2b630d2

Browse files
committed
More symbolic conversion
1 parent 61d605f commit 2b630d2

5 files changed

Lines changed: 60 additions & 82 deletions

File tree

libnemo-private/nemo-file.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4395,7 +4395,11 @@ get_symbolic_icon_for_file (NemoFile *file)
43954395
return g_themed_icon_new (NEMO_ICON_SYMBOLIC_FOLDER_TEMPLATES);
43964396
}
43974397

4398-
return g_content_type_get_symbolic_icon (file->details->mime_type);
4398+
if (file->details->mime_type != NULL) {
4399+
return g_content_type_get_symbolic_icon (file->details->mime_type);
4400+
} else {
4401+
return NULL;
4402+
}
43994403
}
44004404

44014405
GIcon *

libnemo-private/nemo-icon-names.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
/* Icons not provided by fd.o naming spec or nemo itself */
3232
#define NEMO_ICON_BURN "nemo-cd-burner"
3333

34-
34+
#define NEMO_ICON_SYMBOLIC_COMPUTER "computer-symbolic"
3535
#define NEMO_ICON_SYMBOLIC_DESKTOP "user-desktop-symbolic"
3636
#define NEMO_ICON_SYMBOLIC_FILESYSTEM "drive-harddisk-symbolic"
3737
#define NEMO_ICON_SYMBOLIC_FOLDER "folder-symbolic"

src/nemo-pathbar.c

Lines changed: 31 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,42 +1457,6 @@ button_clicked_cb (GtkWidget *button,
14571457
g_signal_emit (path_bar, path_bar_signals [PATH_CLICKED], 0, button_data->path);
14581458
}
14591459

1460-
static NemoIconInfo *
1461-
get_type_icon_info (ButtonData *button_data, gint scale)
1462-
{
1463-
switch (button_data->type)
1464-
{
1465-
case ROOT_BUTTON:
1466-
return nemo_icon_info_lookup_from_name (NEMO_ICON_FILESYSTEM,
1467-
NEMO_PATH_BAR_ICON_SIZE, scale);
1468-
1469-
case HOME_BUTTON:
1470-
return nemo_icon_info_lookup_from_name (NEMO_ICON_HOME,
1471-
NEMO_PATH_BAR_ICON_SIZE, scale);
1472-
1473-
case DESKTOP_BUTTON:
1474-
return nemo_icon_info_lookup_from_name (NEMO_ICON_DESKTOP,
1475-
NEMO_PATH_BAR_ICON_SIZE, scale);
1476-
case XDG_BUTTON:
1477-
return nemo_icon_info_lookup_from_name (button_data->xdg_icon,
1478-
NEMO_PATH_BAR_ICON_SIZE, scale);
1479-
case NORMAL_BUTTON:
1480-
if (button_data->is_base_dir) {
1481-
return nemo_file_get_icon (button_data->file,
1482-
NEMO_PATH_BAR_ICON_SIZE, 0,
1483-
scale,
1484-
NEMO_FILE_ICON_FLAGS_NONE);
1485-
}
1486-
return NULL;
1487-
case DEFAULT_LOCATION_BUTTON:
1488-
case MOUNT_BUTTON:
1489-
default:
1490-
return NULL;
1491-
}
1492-
1493-
return NULL;
1494-
}
1495-
14961460
static void
14971461
button_data_free (ButtonData *button_data)
14981462
{
@@ -1561,8 +1525,8 @@ set_label_padding_size (ButtonData *button_data)
15611525
static void
15621526
nemo_path_bar_update_button_appearance (ButtonData *button_data, gint scale)
15631527
{
1564-
NemoIconInfo *icon_info;
1565-
GdkPixbuf *pixbuf;
1528+
GIcon *gicon;
1529+
15661530
const gchar *dir_name = get_dir_name (button_data);
15671531

15681532
if (button_data->label != NULL) {
@@ -1582,31 +1546,29 @@ nemo_path_bar_update_button_appearance (ButtonData *button_data, gint scale)
15821546
}
15831547

15841548
if (button_data->image != NULL) {
1585-
if (button_data->custom_icon) {
1586-
cairo_surface_t *surface;
1587-
surface = gdk_cairo_surface_create_from_pixbuf (button_data->custom_icon, scale, NULL);
1588-
g_object_set (GTK_IMAGE (button_data->image), "surface", surface, NULL);
1589-
gtk_widget_show (GTK_WIDGET (button_data->image));
1590-
} else {
1591-
icon_info = get_type_icon_info (button_data, scale);
1592-
1593-
pixbuf = NULL;
1594-
1595-
if (icon_info != NULL) {
1596-
pixbuf = nemo_icon_info_get_pixbuf_at_size (icon_info, NEMO_PATH_BAR_ICON_SIZE);
1597-
g_object_unref (icon_info);
1598-
}
1549+
switch (button_data->type) {
1550+
case ROOT_BUTTON:
1551+
gicon = g_themed_icon_new (NEMO_ICON_SYMBOLIC_FILESYSTEM);
1552+
break;
1553+
case HOME_BUTTON:
1554+
case DESKTOP_BUTTON:
1555+
case XDG_BUTTON:
1556+
gicon = nemo_file_get_control_icon (button_data->file);
1557+
break;
1558+
case NORMAL_BUTTON:
1559+
if (button_data->is_base_dir) {
1560+
gicon = nemo_file_get_control_icon (button_data->file);
1561+
break;
1562+
}
1563+
case DEFAULT_LOCATION_BUTTON:
1564+
case MOUNT_BUTTON:
1565+
default:
1566+
gicon = NULL;
1567+
}
15991568

1600-
if (pixbuf != NULL) {
1601-
cairo_surface_t *surface;
1602-
surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, scale, NULL);
1603-
g_object_set (GTK_IMAGE (button_data->image), "surface", surface, NULL);
1604-
gtk_widget_show (GTK_WIDGET (button_data->image));
1605-
g_object_unref (pixbuf);
1606-
} else {
1607-
gtk_widget_hide (GTK_WIDGET (button_data->image));
1608-
}
1609-
}
1569+
gtk_image_set_from_gicon (GTK_IMAGE (button_data->image),
1570+
gicon,
1571+
GTK_ICON_SIZE_MENU);
16101572
}
16111573

16121574
}
@@ -1718,25 +1680,25 @@ setup_button_type (ButtonData *button_data,
17181680
}
17191681
} else if (path_bar->priv->xdg_documents_path != NULL && g_file_equal (location, path_bar->priv->xdg_documents_path)) {
17201682
button_data->type = XDG_BUTTON;
1721-
button_data->xdg_icon = g_strdup (NEMO_ICON_FOLDER_DOCUMENTS);
1683+
button_data->xdg_icon = g_strdup (NEMO_ICON_SYMBOLIC_FOLDER_DOCUMENTS);
17221684
} else if (path_bar->priv->xdg_download_path != NULL && g_file_equal (location, path_bar->priv->xdg_download_path)) {
17231685
button_data->type = XDG_BUTTON;
1724-
button_data->xdg_icon = g_strdup (NEMO_ICON_FOLDER_DOWNLOAD);
1686+
button_data->xdg_icon = g_strdup (NEMO_ICON_SYMBOLIC_FOLDER_DOWNLOAD);
17251687
} else if (path_bar->priv->xdg_music_path != NULL && g_file_equal (location, path_bar->priv->xdg_music_path)) {
17261688
button_data->type = XDG_BUTTON;
1727-
button_data->xdg_icon = g_strdup (NEMO_ICON_FOLDER_MUSIC);
1689+
button_data->xdg_icon = g_strdup (NEMO_ICON_SYMBOLIC_FOLDER_MUSIC);
17281690
} else if (path_bar->priv->xdg_pictures_path != NULL && g_file_equal (location, path_bar->priv->xdg_pictures_path)) {
17291691
button_data->type = XDG_BUTTON;
1730-
button_data->xdg_icon = g_strdup (NEMO_ICON_FOLDER_PICTURES);
1692+
button_data->xdg_icon = g_strdup (NEMO_ICON_SYMBOLIC_FOLDER_PICTURES);
17311693
} else if (path_bar->priv->xdg_templates_path != NULL && g_file_equal (location, path_bar->priv->xdg_templates_path)) {
17321694
button_data->type = XDG_BUTTON;
1733-
button_data->xdg_icon = g_strdup (NEMO_ICON_FOLDER_TEMPLATES);
1695+
button_data->xdg_icon = g_strdup (NEMO_ICON_SYMBOLIC_FOLDER_TEMPLATES);
17341696
} else if (path_bar->priv->xdg_videos_path != NULL && g_file_equal (location, path_bar->priv->xdg_videos_path)) {
17351697
button_data->type = XDG_BUTTON;
1736-
button_data->xdg_icon = g_strdup (NEMO_ICON_FOLDER_VIDEOS);
1698+
button_data->xdg_icon = g_strdup (NEMO_ICON_SYMBOLIC_FOLDER_VIDEOS);
17371699
} else if (path_bar->priv->xdg_public_path != NULL && g_file_equal (location, path_bar->priv->xdg_public_path)) {
17381700
button_data->type = XDG_BUTTON;
1739-
button_data->xdg_icon = g_strdup (NEMO_ICON_FOLDER_PUBLIC_SHARE);
1701+
button_data->xdg_icon = g_strdup (NEMO_ICON_SYMBOLIC_FOLDER_PUBLIC_SHARE);
17401702
} else if (setup_file_path_mounted_mount (location, button_data,
17411703
gtk_widget_get_scale_factor (GTK_WIDGET (path_bar)))) {
17421704
/* already setup */

src/nemo-view.c

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5149,6 +5149,18 @@ add_place_to_action (NemoView *view, const gchar *bookmark_name, GIcon *icon, gc
51495149
view);
51505150
}
51515151

5152+
// FIXME: duplicated in nemo-places-sidebar.c
5153+
static GIcon *
5154+
get_mount_gicon (GMount *mount)
5155+
{
5156+
GIcon *icon;
5157+
5158+
if (g_mount_can_eject (mount)) {
5159+
return g_themed_icon_new ("media-removable-symbolic");
5160+
}
5161+
5162+
return g_mount_get_symbolic_icon (mount);
5163+
}
51525164

51535165
static void
51545166
reset_move_copy_to_menu (NemoView *view)
@@ -5292,7 +5304,7 @@ reset_move_copy_to_menu (NemoView *view)
52925304
}
52935305
}
52945306

5295-
icon = g_mount_get_icon (mount);
5307+
icon = get_mount_gicon (mount);
52965308
mount_uri = g_file_get_uri (root);
52975309
name = g_mount_get_name (mount);
52985310

@@ -5334,7 +5346,7 @@ reset_move_copy_to_menu (NemoView *view)
53345346
mount = g_volume_get_mount (volume);
53355347
if (mount != NULL) {
53365348
/* Show mounted volume in the sidebar */
5337-
icon = g_mount_get_icon (mount);
5349+
icon = get_mount_gicon (mount);
53385350
root = g_mount_get_default_location (mount);
53395351
mount_uri = g_file_get_uri (root);
53405352
name = g_mount_get_name (mount);
@@ -5382,7 +5394,7 @@ reset_move_copy_to_menu (NemoView *view)
53825394

53835395
mount = g_volume_get_mount (volume);
53845396
if (mount != NULL) {
5385-
icon = g_mount_get_icon (mount);
5397+
icon = get_mount_gicon (mount);
53865398
root = g_mount_get_default_location (mount);
53875399
mount_uri = g_file_get_uri (root);
53885400

@@ -5423,7 +5435,7 @@ reset_move_copy_to_menu (NemoView *view)
54235435
for (l = network_mounts; l != NULL; l = l->next) {
54245436
mount = l->data;
54255437
root = g_mount_get_default_location (mount);
5426-
icon = g_mount_get_icon (mount);
5438+
icon = get_mount_gicon (mount);
54275439
mount_uri = g_file_get_uri (root);
54285440
name = g_mount_get_name (mount);
54295441

@@ -8465,11 +8477,11 @@ static const GtkActionEntry directory_view_entries[] = {
84658477
N_("_Desktop"), NULL,
84668478
N_("Move the current selection to the desktop"),
84678479
G_CALLBACK (action_move_to_desktop_callback) },
8468-
{NEMO_ACTION_BROWSE_MOVE_TO, GTK_STOCK_DIRECTORY,
8480+
{NEMO_ACTION_BROWSE_MOVE_TO, "document-open-symbolic",
84698481
N_("Browse…"), NULL,
84708482
N_("Browse for a folder to move the selection to"),
84718483
G_CALLBACK (action_browse_for_move_to_folder_callback) },
8472-
{NEMO_ACTION_BROWSE_COPY_TO, GTK_STOCK_DIRECTORY,
8484+
{NEMO_ACTION_BROWSE_COPY_TO, "document-open-symbolic",
84738485
N_("Browse…"), NULL,
84748486
N_("Browse for a folder to copy the selection to"),
84758487
G_CALLBACK (action_browse_for_copy_to_folder_callback) }

src/nemo-window-menus.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,23 +1278,23 @@ static const GtkActionEntry main_entries[] = {
12781278
/* label, accelerator */ N_("Connect to _Server..."), NULL,
12791279
/* tooltip */ N_("Connect to a remote computer or shared disk"),
12801280
G_CALLBACK (action_connect_to_server_callback) },
1281-
/* name, stock id */ { "Home", NEMO_ICON_HOME,
1281+
/* name, stock id */ { "Home", NEMO_ICON_SYMBOLIC_HOME,
12821282
/* label, accelerator */ N_("_Home"), "<alt>Home",
12831283
/* tooltip */ N_("Open your personal folder"),
12841284
G_CALLBACK (action_home_callback) },
1285-
/* name, stock id */ { "Go to Computer", NEMO_ICON_COMPUTER,
1285+
/* name, stock id */ { "Go to Computer", NEMO_ICON_SYMBOLIC_COMPUTER,
12861286
/* label, accelerator */ N_("_Computer"), NULL,
12871287
/* tooltip */ N_("Browse all local and remote disks and folders accessible from this computer"),
12881288
G_CALLBACK (action_go_to_computer_callback) },
1289-
/* name, stock id */ { "Go to Network", NEMO_ICON_NETWORK,
1289+
/* name, stock id */ { "Go to Network", NEMO_ICON_SYMBOLIC_NETWORK,
12901290
/* label, accelerator */ N_("_Network"), NULL,
12911291
/* tooltip */ N_("Browse bookmarked and local network locations"),
12921292
G_CALLBACK (action_go_to_network_callback) },
1293-
/* name, stock id */ { "Go to Templates", NEMO_ICON_TEMPLATE,
1293+
/* name, stock id */ { "Go to Templates", NEMO_ICON_SYMBOLIC_FOLDER_TEMPLATES,
12941294
/* label, accelerator */ N_("T_emplates"), NULL,
12951295
/* tooltip */ N_("Open your personal templates folder"),
12961296
G_CALLBACK (action_go_to_templates_callback) },
1297-
/* name, stock id */ { "Go to Trash", NEMO_ICON_TRASH,
1297+
/* name, stock id */ { "Go to Trash", NEMO_ICON_SYMBOLIC_TRASH,
12981298
/* label, accelerator */ N_("_Trash"), NULL,
12991299
/* tooltip */ N_("Open your personal trash folder"),
13001300
G_CALLBACK (action_go_to_trash_callback) },

0 commit comments

Comments
 (0)