@@ -86,11 +86,7 @@ typedef struct {
8686 NemoFile * file ;
8787 unsigned int file_changed_signal_id ;
8888
89- /* custom icon */
90- GdkPixbuf * custom_icon ;
91-
92- char * xdg_icon ;
93-
89+ GIcon * mount_icon ;
9490 /* flag to indicate its the base folder in the URI */
9591 gboolean is_base_dir ;
9692
@@ -128,7 +124,6 @@ struct _NemoPathBarDetails {
128124 GtkWidget * up_slider_button ;
129125 GtkWidget * down_slider_button ;
130126 guint settings_signal_id ;
131- gint icon_size ;
132127 gint slider_width ;
133128 gint16 spacing ;
134129 gint16 button_offset ;
@@ -155,11 +150,9 @@ static gboolean nemo_path_bar_slider_button_release (GtkWidget *widget,
155150 GdkEventButton * event ,
156151 NemoPathBar * path_bar );
157152static void nemo_path_bar_check_icon_theme (NemoPathBar * path_bar );
158- static void nemo_path_bar_update_button_appearance (ButtonData * button_data ,
159- gint scale );
153+ static void nemo_path_bar_update_button_appearance (ButtonData * button_data );
160154static void nemo_path_bar_update_button_state (ButtonData * button_data ,
161- gboolean current_dir ,
162- gint scale );
155+ gboolean current_dir );
163156static gboolean nemo_path_bar_update_path (NemoPathBar * path_bar ,
164157 GFile * file_path ,
165158 gboolean emit_signal );
@@ -351,7 +344,6 @@ nemo_path_bar_init (NemoPathBar *path_bar)
351344
352345 path_bar -> priv -> up_slider_button = get_slider_button (path_bar , GTK_POS_LEFT );
353346 path_bar -> priv -> down_slider_button = get_slider_button (path_bar , GTK_POS_RIGHT );
354- path_bar -> priv -> icon_size = NEMO_PATH_BAR_ICON_SIZE ;
355347
356348 p = nemo_get_desktop_directory ();
357349 path_bar -> priv -> desktop_path = g_file_new_for_path (p );
@@ -1383,8 +1375,7 @@ reload_icons (NemoPathBar *path_bar)
13831375 ButtonData * button_data ;
13841376 button_data = BUTTON_DATA (list -> data );
13851377 if (button_data -> type != NORMAL_BUTTON || button_data -> is_base_dir ) {
1386- nemo_path_bar_update_button_appearance (button_data ,
1387- gtk_widget_get_scale_factor (GTK_WIDGET (path_bar )));
1378+ nemo_path_bar_update_button_appearance (button_data );
13881379 }
13891380 }
13901381}
@@ -1458,12 +1449,9 @@ button_data_free (ButtonData *button_data)
14581449{
14591450 g_object_unref (button_data -> path );
14601451 g_free (button_data -> dir_name );
1461- if (button_data -> custom_icon ) {
1462- g_object_unref (button_data -> custom_icon );
1463- }
1464- if (button_data -> type == XDG_BUTTON ) {
1465- g_free (button_data -> xdg_icon );
1466- }
1452+
1453+ g_clear_object (& button_data -> mount_icon );
1454+
14671455 if (button_data -> file != NULL ) {
14681456 g_signal_handler_disconnect (button_data -> file ,
14691457 button_data -> file_changed_signal_id );
@@ -1519,7 +1507,7 @@ set_label_padding_size (ButtonData *button_data)
15191507}
15201508
15211509static void
1522- nemo_path_bar_update_button_appearance (ButtonData * button_data , gint scale )
1510+ nemo_path_bar_update_button_appearance (ButtonData * button_data )
15231511{
15241512 GIcon * gicon ;
15251513
@@ -1558,6 +1546,10 @@ nemo_path_bar_update_button_appearance (ButtonData *button_data, gint scale)
15581546 }
15591547 case DEFAULT_LOCATION_BUTTON :
15601548 case MOUNT_BUTTON :
1549+ if (button_data -> mount_icon ) {
1550+ gicon = button_data -> mount_icon ;
1551+ break ;
1552+ }
15611553 default :
15621554 gicon = NULL ;
15631555 }
@@ -1571,15 +1563,14 @@ nemo_path_bar_update_button_appearance (ButtonData *button_data, gint scale)
15711563
15721564static void
15731565nemo_path_bar_update_button_state (ButtonData * button_data ,
1574- gboolean current_dir ,
1575- gint scale )
1566+ gboolean current_dir )
15761567{
15771568 if (button_data -> label != NULL ) {
15781569 gtk_label_set_label (GTK_LABEL (button_data -> label ), NULL );
15791570 gtk_label_set_use_markup (GTK_LABEL (button_data -> label ), current_dir );
15801571 }
15811572
1582- nemo_path_bar_update_button_appearance (button_data , scale );
1573+ nemo_path_bar_update_button_appearance (button_data );
15831574
15841575 if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_data -> button )) != current_dir ) {
15851576 button_data -> ignore_changes = TRUE;
@@ -1589,14 +1580,12 @@ nemo_path_bar_update_button_state (ButtonData *button_data,
15891580}
15901581
15911582static gboolean
1592- setup_file_path_mounted_mount (GFile * location , ButtonData * button_data , gint scale )
1583+ setup_file_path_mounted_mount (GFile * location , ButtonData * button_data )
15931584{
15941585 GVolumeMonitor * volume_monitor ;
15951586 GList * mounts , * l ;
15961587 GMount * mount ;
15971588 gboolean result ;
1598- GIcon * icon ;
1599- NemoIconInfo * info ;
16001589 GFile * root , * default_location ;
16011590
16021591 result = FALSE;
@@ -1615,14 +1604,7 @@ setup_file_path_mounted_mount (GFile *location, ButtonData *button_data, gint sc
16151604 result = TRUE;
16161605 /* set mount specific details in button_data */
16171606 if (button_data ) {
1618- icon = g_mount_get_icon (mount );
1619- if (icon == NULL ) {
1620- icon = g_themed_icon_new (NEMO_ICON_FOLDER );
1621- }
1622- info = nemo_icon_info_lookup (icon , NEMO_PATH_BAR_ICON_SIZE , scale );
1623- g_object_unref (icon );
1624- button_data -> custom_icon = nemo_icon_info_get_pixbuf_at_size (info , NEMO_PATH_BAR_ICON_SIZE );
1625- g_object_unref (info );
1607+ button_data -> mount_icon = nemo_get_mount_gicon (mount );
16261608 button_data -> dir_name = g_mount_get_name (mount );
16271609 button_data -> type = MOUNT_BUTTON ;
16281610 button_data -> fake_root = TRUE;
@@ -1636,14 +1618,7 @@ setup_file_path_mounted_mount (GFile *location, ButtonData *button_data, gint sc
16361618 result = TRUE;
16371619 /* set mount specific details in button_data */
16381620 if (button_data ) {
1639- icon = g_mount_get_icon (mount );
1640- if (icon == NULL ) {
1641- icon = g_themed_icon_new (NEMO_ICON_FOLDER );
1642- }
1643- info = nemo_icon_info_lookup (icon , NEMO_PATH_BAR_ICON_SIZE , scale );
1644- g_object_unref (icon );
1645- button_data -> custom_icon = nemo_icon_info_get_pixbuf_at_size (info , NEMO_PATH_BAR_ICON_SIZE );
1646- g_object_unref (info );
1621+ button_data -> mount_icon = nemo_get_mount_gicon (mount );
16471622 button_data -> type = DEFAULT_LOCATION_BUTTON ;
16481623 button_data -> fake_root = TRUE;
16491624 }
@@ -1676,27 +1651,19 @@ setup_button_type (ButtonData *button_data,
16761651 }
16771652 } else if (path_bar -> priv -> xdg_documents_path != NULL && g_file_equal (location , path_bar -> priv -> xdg_documents_path )) {
16781653 button_data -> type = XDG_BUTTON ;
1679- button_data -> xdg_icon = g_strdup (NEMO_ICON_SYMBOLIC_FOLDER_DOCUMENTS );
16801654 } else if (path_bar -> priv -> xdg_download_path != NULL && g_file_equal (location , path_bar -> priv -> xdg_download_path )) {
16811655 button_data -> type = XDG_BUTTON ;
1682- button_data -> xdg_icon = g_strdup (NEMO_ICON_SYMBOLIC_FOLDER_DOWNLOAD );
16831656 } else if (path_bar -> priv -> xdg_music_path != NULL && g_file_equal (location , path_bar -> priv -> xdg_music_path )) {
16841657 button_data -> type = XDG_BUTTON ;
1685- button_data -> xdg_icon = g_strdup (NEMO_ICON_SYMBOLIC_FOLDER_MUSIC );
16861658 } else if (path_bar -> priv -> xdg_pictures_path != NULL && g_file_equal (location , path_bar -> priv -> xdg_pictures_path )) {
16871659 button_data -> type = XDG_BUTTON ;
1688- button_data -> xdg_icon = g_strdup (NEMO_ICON_SYMBOLIC_FOLDER_PICTURES );
16891660 } else if (path_bar -> priv -> xdg_templates_path != NULL && g_file_equal (location , path_bar -> priv -> xdg_templates_path )) {
16901661 button_data -> type = XDG_BUTTON ;
1691- button_data -> xdg_icon = g_strdup (NEMO_ICON_SYMBOLIC_FOLDER_TEMPLATES );
16921662 } else if (path_bar -> priv -> xdg_videos_path != NULL && g_file_equal (location , path_bar -> priv -> xdg_videos_path )) {
16931663 button_data -> type = XDG_BUTTON ;
1694- button_data -> xdg_icon = g_strdup (NEMO_ICON_SYMBOLIC_FOLDER_VIDEOS );
16951664 } else if (path_bar -> priv -> xdg_public_path != NULL && g_file_equal (location , path_bar -> priv -> xdg_public_path )) {
16961665 button_data -> type = XDG_BUTTON ;
1697- button_data -> xdg_icon = g_strdup (NEMO_ICON_SYMBOLIC_FOLDER_PUBLIC_SHARE );
1698- } else if (setup_file_path_mounted_mount (location , button_data ,
1699- gtk_widget_get_scale_factor (GTK_WIDGET (path_bar )))) {
1666+ } else if (setup_file_path_mounted_mount (location , button_data )) {
17001667 /* already setup */
17011668 } else {
17021669 button_data -> type = NORMAL_BUTTON ;
@@ -1860,8 +1827,7 @@ button_data_file_changed (NemoFile *file,
18601827
18611828 g_free (display_name );
18621829 }
1863- nemo_path_bar_update_button_appearance (button_data ,
1864- gtk_widget_get_scale_factor (GTK_WIDGET (path_bar )));
1830+ nemo_path_bar_update_button_appearance (button_data );
18651831}
18661832
18671833static ButtonData *
@@ -1936,8 +1902,7 @@ make_directory_button (NemoPathBar *path_bar,
19361902 gtk_container_add (GTK_CONTAINER (button_data -> button ), child );
19371903 gtk_widget_show_all (button_data -> button );
19381904
1939- nemo_path_bar_update_button_state (button_data , current_dir ,
1940- gtk_widget_get_scale_factor (GTK_WIDGET (path_bar )));
1905+ nemo_path_bar_update_button_state (button_data , current_dir );
19411906
19421907 g_signal_connect (button_data -> button , "clicked" , G_CALLBACK (button_clicked_cb ), button_data );
19431908 g_object_weak_ref (G_OBJECT (button_data -> button ), (GWeakNotify ) button_data_free , button_data );
@@ -2001,8 +1966,7 @@ nemo_path_bar_check_parent_path (NemoPathBar *path_bar,
20011966
20021967 for (list = path_bar -> priv -> button_list ; list ; list = list -> next ) {
20031968 nemo_path_bar_update_button_state (BUTTON_DATA (list -> data ),
2004- (list == current_path ) ? TRUE : FALSE,
2005- gtk_widget_get_scale_factor (GTK_WIDGET (path_bar )));
1969+ (list == current_path ) ? TRUE : FALSE);
20061970 }
20071971
20081972 if (!gtk_widget_get_child_visible (BUTTON_DATA (current_path -> data )-> button )) {
0 commit comments