7777typedef struct {
7878 GtkScrolledWindow parent ;
7979 GtkTreeView * tree_view ;
80- GtkCellRenderer * eject_icon_cell_renderer ;
80+ GtkCellRenderer * eject_icon_cell_renderer ;
8181 char * uri ;
8282 GtkTreeStore * store ;
8383 GtkTreeModel * store_filter ;
@@ -124,8 +124,6 @@ typedef struct {
124124 NemoWindowSlot * go_to_after_mount_slot ;
125125 NemoWindowOpenFlags go_to_after_mount_flags ;
126126
127- GtkTreePath * eject_highlight_path ;
128-
129127 NotifyNotification * unmount_notify ;
130128
131129 guint bookmarks_changed_id ;
@@ -330,61 +328,6 @@ decrement_bookmark_breakpoint (NemoPlacesSidebar *sidebar)
330328 g_signal_handlers_unblock_by_func (nemo_window_state , breakpoint_changed_cb , sidebar );
331329}
332330
333- static cairo_surface_t *
334- get_eject_icon (NemoPlacesSidebar * sidebar ,
335- gboolean highlighted )
336- {
337- GdkPixbuf * eject ;
338- GtkIconInfo * icon_info ;
339- GIcon * icon ;
340- int icon_size ;
341- GtkIconTheme * icon_theme ;
342- GtkStyleContext * style ;
343- GtkStateFlags state ;
344- cairo_surface_t * surface ;
345- gint scale = 1 ;
346-
347- scale = gtk_widget_get_scale_factor (GTK_WIDGET (sidebar ));
348- icon_theme = gtk_icon_theme_get_default ();
349- icon_size = nemo_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU );
350- icon = g_themed_icon_new ("media-eject-symbolic" );
351- icon_info = gtk_icon_theme_lookup_by_gicon_for_scale (icon_theme , icon , icon_size , scale , 0 );
352-
353- style = gtk_widget_get_style_context (GTK_WIDGET (sidebar ));
354- gtk_style_context_save (style );
355-
356- if (icon_info != NULL ) {
357- state = gtk_widget_get_state_flags (GTK_WIDGET (sidebar ));
358- gtk_style_context_add_class (style , GTK_STYLE_CLASS_IMAGE );
359-
360- if (highlighted ) {
361- state |= GTK_STATE_FLAG_PRELIGHT ;
362- }
363-
364- gtk_style_context_set_state (style , state );
365-
366- eject = gtk_icon_info_load_symbolic_for_context (icon_info ,
367- style ,
368- NULL ,
369- NULL );
370-
371- g_object_unref (icon_info );
372- } else {
373- GtkIconSet * icon_set ;
374-
375- gtk_style_context_set_state (style , GTK_STATE_FLAG_NORMAL );
376- icon_set = gtk_style_context_lookup_icon_set (style , GTK_STOCK_MISSING_IMAGE );
377- eject = gtk_icon_set_render_icon_pixbuf (icon_set , style , GTK_ICON_SIZE_MENU );
378- }
379-
380- gtk_style_context_restore (style );
381- g_object_unref (icon );
382-
383- surface = gdk_cairo_surface_create_from_pixbuf (eject , scale , NULL );
384- g_object_unref (eject );
385- return surface ;
386- }
387-
388331static gboolean
389332should_show_desktop (void )
390333{
@@ -457,7 +400,6 @@ add_place (NemoPlacesSidebar *sidebar,
457400 GtkTreeIter cat_iter )
458401{
459402 GtkTreeIter iter ;
460- cairo_surface_t * eject ;
461403 gboolean show_eject , show_unmount ;
462404 gboolean show_eject_button ;
463405
@@ -476,12 +418,6 @@ add_place (NemoPlacesSidebar *sidebar,
476418 show_eject_button = (show_unmount || show_eject );
477419 }
478420
479- if (show_eject_button ) {
480- eject = get_eject_icon (sidebar , FALSE);
481- } else {
482- eject = NULL ;
483- }
484-
485421 gtk_tree_store_append (sidebar -> store , & iter , & cat_iter );
486422 gtk_tree_store_set (sidebar -> store , & iter ,
487423 PLACES_SIDEBAR_COLUMN_ICON , icon ,
@@ -496,7 +432,7 @@ add_place (NemoPlacesSidebar *sidebar,
496432 PLACES_SIDEBAR_COLUMN_NO_EJECT , !show_eject_button ,
497433 PLACES_SIDEBAR_COLUMN_BOOKMARK , place_type != PLACES_BOOKMARK ,
498434 PLACES_SIDEBAR_COLUMN_TOOLTIP , tooltip ,
499- PLACES_SIDEBAR_COLUMN_EJECT_ICON , eject ,
435+ PLACES_SIDEBAR_COLUMN_EJECT_ICON , show_eject_button ? "media- eject-symbolic" : NULL ,
500436 PLACES_SIDEBAR_COLUMN_SECTION_TYPE , section_type ,
501437 PLACES_SIDEBAR_COLUMN_DF_PERCENT , df_percent ,
502438 PLACES_SIDEBAR_COLUMN_SHOW_DF , show_df_percent ,
@@ -3584,113 +3520,6 @@ bookmarks_button_release_event_cb (GtkWidget *widget,
35843520 return FALSE;
35853521}
35863522
3587- static void
3588- update_eject_buttons (NemoPlacesSidebar * sidebar ,
3589- GtkTreePath * path )
3590- {
3591- GtkTreeIter iter , store_iter ;
3592- gboolean icon_visible , path_same ;
3593-
3594- icon_visible = TRUE;
3595-
3596- if (path == NULL && sidebar -> eject_highlight_path == NULL ) {
3597- /* Both are null - highlight up to date */
3598- return ;
3599- }
3600-
3601- path_same = (path != NULL ) &&
3602- (sidebar -> eject_highlight_path != NULL ) &&
3603- (gtk_tree_path_compare (sidebar -> eject_highlight_path , path ) == 0 );
3604-
3605- if (path_same ) {
3606- /* Same path - highlight up to date */
3607- return ;
3608- }
3609-
3610- if (path ) {
3611- gtk_tree_model_get_iter (GTK_TREE_MODEL (sidebar -> store_filter ),
3612- & iter ,
3613- path );
3614-
3615- gtk_tree_model_get (GTK_TREE_MODEL (sidebar -> store_filter ),
3616- & iter ,
3617- PLACES_SIDEBAR_COLUMN_EJECT , & icon_visible ,
3618- -1 );
3619- }
3620-
3621- if (!icon_visible || path == NULL || !path_same ) {
3622- /* remove highlighting and reset the saved path, as we are leaving
3623- * an eject button area.
3624- */
3625- if (sidebar -> eject_highlight_path ) {
3626- gtk_tree_model_get_iter (GTK_TREE_MODEL (sidebar -> store_filter ),
3627- & iter ,
3628- sidebar -> eject_highlight_path );
3629-
3630- gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (sidebar -> store_filter ),
3631- & store_iter ,
3632- & iter );
3633-
3634- gtk_tree_store_set (sidebar -> store ,
3635- & store_iter ,
3636- PLACES_SIDEBAR_COLUMN_EJECT_ICON , get_eject_icon (sidebar , FALSE),
3637- -1 );
3638-
3639- gtk_tree_path_free (sidebar -> eject_highlight_path );
3640- sidebar -> eject_highlight_path = NULL ;
3641- }
3642-
3643- if (!icon_visible ) {
3644- return ;
3645- }
3646- }
3647-
3648- if (path != NULL ) {
3649- /* add highlighting to the selected path, as the icon is visible and
3650- * we're hovering it.
3651- */
3652- gtk_tree_model_get_iter (GTK_TREE_MODEL (sidebar -> store_filter ),
3653- & iter ,
3654- path );
3655-
3656- gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (sidebar -> store_filter ),
3657- & store_iter ,
3658- & iter );
3659-
3660- gtk_tree_store_set (sidebar -> store ,
3661- & store_iter ,
3662- PLACES_SIDEBAR_COLUMN_EJECT_ICON , get_eject_icon (sidebar , TRUE),
3663- -1 );
3664-
3665- sidebar -> eject_highlight_path = gtk_tree_path_copy (path );
3666- }
3667- }
3668-
3669- static gboolean
3670- bookmarks_motion_event_cb (GtkWidget * widget ,
3671- GdkEventMotion * event ,
3672- NemoPlacesSidebar * sidebar )
3673- {
3674- GtkTreePath * path ;
3675-
3676- path = NULL ;
3677-
3678- if (over_eject_button (sidebar , event -> x , event -> y , & path )) {
3679- update_eject_buttons (sidebar , path );
3680- gtk_tree_path_free (path );
3681-
3682- return TRUE;
3683- }
3684-
3685- update_eject_buttons (sidebar , NULL );
3686-
3687- return FALSE;
3688- }
3689-
3690- /* Callback used when a button is pressed on the shortcuts list.
3691- * We trap button 3 to bring up a popup menu, and button 2 to
3692- * open in a new tab.
3693- */
36943523static gboolean
36953524bookmarks_button_press_event_cb (GtkWidget * widget ,
36963525 GdkEventButton * event ,
@@ -4133,7 +3962,7 @@ nemo_places_sidebar_init (NemoPlacesSidebar *sidebar)
41333962 gtk_tree_view_column_pack_start (eject_col , cell , FALSE);
41343963 gtk_tree_view_column_set_attributes (eject_col , cell ,
41353964 "visible" , PLACES_SIDEBAR_COLUMN_EJECT ,
4136- "surface " , PLACES_SIDEBAR_COLUMN_EJECT_ICON ,
3965+ "icon-name " , PLACES_SIDEBAR_COLUMN_EJECT_ICON ,
41373966 NULL );
41383967
41393968 /* normal text renderer */
@@ -4250,8 +4079,6 @@ nemo_places_sidebar_init (NemoPlacesSidebar *sidebar)
42504079 G_CALLBACK (bookmarks_popup_menu_cb ), sidebar );
42514080 g_signal_connect (tree_view , "button-press-event" ,
42524081 G_CALLBACK (bookmarks_button_press_event_cb ), sidebar );
4253- g_signal_connect (tree_view , "motion-notify-event" ,
4254- G_CALLBACK (bookmarks_motion_event_cb ), sidebar );
42554082 g_signal_connect (tree_view , "button-release-event" ,
42564083 G_CALLBACK (bookmarks_button_release_event_cb ), sidebar );
42574084 g_signal_connect (tree_view , "row-expanded" ,
@@ -4295,11 +4122,6 @@ nemo_places_sidebar_dispose (GObject *object)
42954122 free_drag_data (sidebar );
42964123 g_clear_object (& sidebar -> unmount_notify );
42974124
4298- if (sidebar -> eject_highlight_path != NULL ) {
4299- gtk_tree_path_free (sidebar -> eject_highlight_path );
4300- sidebar -> eject_highlight_path = NULL ;
4301- }
4302-
43034125 if (sidebar -> bookmarks_changed_id != 0 ) {
43044126 g_signal_handler_disconnect (sidebar -> bookmarks ,
43054127 sidebar -> bookmarks_changed_id );
@@ -4545,7 +4367,7 @@ nemo_shortcuts_model_new (NemoPlacesSidebar *sidebar)
45454367 G_TYPE_BOOLEAN ,
45464368 G_TYPE_BOOLEAN ,
45474369 G_TYPE_STRING ,
4548- CAIRO_GOBJECT_TYPE_SURFACE ,
4370+ G_TYPE_STRING ,
45494371 G_TYPE_INT ,
45504372 G_TYPE_STRING ,
45514373 G_TYPE_INT ,
0 commit comments