Commit 21c38ac3 authored by Carlos Soriano Sánchez's avatar Carlos Soriano Sánchez

nautilus-window: don't use libgd notifications

We are using notifications just for one window and one type of
notification and only one notification at once, so we don't need to use
notification-manager from libgd.
Given that the manager is not necessary, the reasons to use libgd
notifications becomes weak.

Instead of libgd notifications create our own with a GtkRevealer and
remove all the libgd notifications, so we have a cleaner code.
parent 89ff8f72
......@@ -178,10 +178,6 @@ nautilus_SOURCES = \
nautilus-list-view.h \
nautilus-location-entry.c \
nautilus-location-entry.h \
nautilus-notification-delete.c \
nautilus-notification-delete.h \
nautilus-notification-manager.c \
nautilus-notification-manager.h \
nautilus-main.c \
nautilus-mime-actions.c \
nautilus-mime-actions.h \
......
/* nautilus-notification-delete.c
*
* Copyright (C) 2015 Carlos Soriano <csoriano@gnome.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <glib/gi18n.h>
#include "nautilus-window.h"
#include "nautilus-notification-delete.h"
#include "nautilus-notification-manager.h"
#include <libnautilus-private/nautilus-file-undo-manager.h>
#include <libnautilus-private/nautilus-file-undo-operations.h>
struct _NautilusNotificationDeletePrivate
{
guint timeout_id;
NautilusWindow *window;
};
G_DEFINE_TYPE_WITH_PRIVATE (NautilusNotificationDelete, nautilus_notification_delete, GTK_TYPE_GRID)
enum {
PROP_0,
PROP_WINDOW,
LAST_PROP
};
#define NOTIFICATION_TIMEOUT 6
static void
nautilus_notification_delete_remove_timeout (NautilusNotificationDelete *self)
{
if (self->priv->timeout_id != 0)
{
g_source_remove (self->priv->timeout_id);
self->priv->timeout_id = 0;
}
}
static void
nautilus_notification_delete_destroy (NautilusNotificationDelete *self)
{
nautilus_notification_delete_remove_timeout (self);
gtk_widget_destroy (GTK_WIDGET (self));
}
static gboolean
nautilus_notification_delete_on_timeout (gpointer user_data)
{
NautilusNotificationDelete *self = NAUTILUS_NOTIFICATION_DELETE (user_data);
self->priv->timeout_id = 0;
gtk_widget_destroy (GTK_WIDGET (self));
return G_SOURCE_REMOVE;
}
static void
nautilus_notification_delete_undo_clicked (NautilusNotificationDelete *self)
{
nautilus_notification_delete_remove_timeout (self);
/* The notification manager will destroy all notifications after the undo
* state changes. So no need to destroy the notification it now */
nautilus_file_undo_manager_undo (GTK_WINDOW (self->priv->window));
}
static void
nautilus_notification_delete_finalize (GObject *object)
{
NautilusNotificationDelete *self = NAUTILUS_NOTIFICATION_DELETE (object);
nautilus_notification_delete_remove_timeout (self);
G_OBJECT_CLASS (nautilus_notification_delete_parent_class)->finalize (object);
}
NautilusNotificationDelete *
nautilus_notification_delete_new (NautilusWindow *window)
{
g_assert (NAUTILUS_IS_WINDOW (window));
return g_object_new (NAUTILUS_TYPE_NOTIFICATION_DELETE,
"window", window,
"margin-start", 12,
"margin-end", 4,
NULL);
}
static void
nautilus_notification_delete_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
NautilusNotificationDelete *self = NAUTILUS_NOTIFICATION_DELETE (object);
switch (prop_id)
{
case PROP_WINDOW:
self->priv->window = g_value_get_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
static void
nautilus_notification_delete_class_init (NautilusNotificationDeleteClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->set_property = nautilus_notification_delete_set_property;
object_class->finalize = nautilus_notification_delete_finalize;
g_object_class_install_property (object_class,
PROP_WINDOW,
g_param_spec_object ("window",
"Window associated",
"The window that contains the notification",
NAUTILUS_TYPE_WINDOW,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE));
}
static void
nautilus_notification_delete_init (NautilusNotificationDelete *self)
{
GtkWidget *close;
gchar *label;
gchar *file_label;
gchar *markup = NULL;
GtkWidget *label_widget;
GtkWidget *undo_widget;
NautilusFileUndoInfo *undo_info;
GList *files;
gint length;
self->priv = nautilus_notification_delete_get_instance_private (self);
undo_info = nautilus_file_undo_manager_get_action ();
g_assert (NAUTILUS_IS_FILE_UNDO_INFO_TRASH (undo_info));
files = nautilus_file_undo_info_trash_get_files (NAUTILUS_FILE_UNDO_INFO_TRASH (undo_info));
length = g_list_length (files);
if (length == 1)
{
file_label = g_file_get_basename (files->data);
markup = g_markup_printf_escaped ("<b>%s</b>", file_label);
label = g_strdup_printf (_("%s deleted"), markup);
}
else
{
/* Translators: this is the first part of a "%d files deleted" string */
file_label = g_strdup_printf (ngettext ("%d file", "%d files", length), length);
markup = g_markup_printf_escaped ("<b>%s</b>", file_label);
/* Translators: this is the second part of a "%d files deleted" string */
label = g_strdup_printf (ngettext ("%s deleted", "%s deleted", length), markup);
}
label_widget = gtk_label_new (label);
gtk_label_set_max_width_chars (GTK_LABEL (label_widget), 50);
gtk_label_set_ellipsize (GTK_LABEL (label_widget), PANGO_ELLIPSIZE_MIDDLE);
gtk_label_set_markup (GTK_LABEL (label_widget), label);
gtk_widget_set_halign (label_widget, GTK_ALIGN_START);
gtk_widget_set_margin_end (label_widget, 30);
gtk_container_add (GTK_CONTAINER (self), label_widget);
undo_widget = gtk_button_new_with_label (_("Undo"));
gtk_widget_set_valign (undo_widget, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (self), undo_widget);
gtk_widget_set_margin_end (undo_widget, 6);
g_signal_connect_swapped (undo_widget, "clicked",
G_CALLBACK (nautilus_notification_delete_undo_clicked),
self);
close = gtk_button_new_from_icon_name ("window-close-symbolic", GTK_ICON_SIZE_BUTTON);
gtk_widget_set_valign (close, GTK_ALIGN_CENTER);
gtk_button_set_focus_on_click (GTK_BUTTON (close), FALSE);
gtk_button_set_relief (GTK_BUTTON (close), GTK_RELIEF_NONE);
gtk_container_add (GTK_CONTAINER (self), close);
g_signal_connect_swapped (close, "clicked",
G_CALLBACK (nautilus_notification_delete_destroy),
self);
self->priv->timeout_id = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT,
NOTIFICATION_TIMEOUT,
nautilus_notification_delete_on_timeout,
g_object_ref (self),
g_object_unref);
g_free (label);
g_free (file_label);
g_free (markup);
g_list_free (files);
}
/* nautilus-notification-delete.h
*
* Copyright (C) 2015 Carlos Soriano <csoriano@gnome.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef NAUTILUS_NOTIFICATION_DELETE_H
#define NAUTILUS_NOTIFICATION_DELETE_H
#include <gtk/gtk.h>
#include "nautilus-window.h"
G_BEGIN_DECLS
#define NAUTILUS_TYPE_NOTIFICATION_DELETE (nautilus_notification_delete_get_type())
#define NAUTILUS_NOTIFICATION_DELETE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_NOTIFICATION_DELETE, NautilusNotificationDelete))
#define NAUTILUS_NOTIFICATION_DELETE_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_NOTIFICATION_DELETE, NautilusNotificationDelete const))
#define NAUTILUS_NOTIFICATION_DELETE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_NOTIFICATION_DELETE, NautilusNotificationDeleteClass))
#define NAUTILUS_IS_NOTIFICATION_DELETE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_NOTIFICATION_DELETE))
#define NAUTILUS_IS_NOTIFICATION_DELETE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_NOTIFICATION_DELETE))
#define NAUTILUS_NOTIFICATION_DELETE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NAUTILUS_TYPE_NOTIFICATION_DELETE, NautilusNotificationDeleteClass))
typedef struct _NautilusNotificationDelete NautilusNotificationDelete;
typedef struct _NautilusNotificationDeleteClass NautilusNotificationDeleteClass;
typedef struct _NautilusNotificationDeletePrivate NautilusNotificationDeletePrivate;
struct _NautilusNotificationDelete
{
GtkGrid parent;
/*< private >*/
NautilusNotificationDeletePrivate *priv;
};
struct _NautilusNotificationDeleteClass
{
GtkGridClass parent;
};
GType nautilus_notification_delete_get_type (void);
NautilusNotificationDelete *nautilus_notification_delete_new (NautilusWindow *window);
G_END_DECLS
#endif /* NAUTILUS_NOTIFICATION_DELETE_H */
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkRevealer" id="notification_delete">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">start</property>
<property name="transition_duration">100</property>
<child>
<object class="GtkFrame">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_start">12</property>
<property name="margin_end">12</property>
<property name="margin_top">2</property>
<property name="margin_bottom">2</property>
<child>
<object class="GtkLabel" id="notification_delete_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="max_width_chars">50</property>
<property name="ellipsize">middle</property>
<property name="margin_end">30</property>
</object>
</child>
<child>
<object class="GtkButton" id="notification_delete_undo">
<property name="label" translatable="yes">undo</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="no_show_all">True</property>
<property name="margin_end">6</property>
</object>
<style>
<class name="text-button"/>
</style>
</child>
<child>
<object class="GtkButton" id="notification_delete_close">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="relief">none</property>
<property name="focus_on_click">False</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">window-close-symbolic</property>
<property name="icon_size">2</property>
</object>
</child>
<style>
<class name="image-button"/>
</style>
</object>
</child>
</object>
</child>
<style>
<class name="app-notification"/>
</style>
</object>
</child>
</object>
</interface>
/* nautilus-notification-manager.c
*
* Copyright (C) 2015 Carlos Soriano <csoriano@gnome.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "nautilus-notification-manager.h"
struct _NautilusNotificationManagerPrivate
{
GtkWidget *grid;
};
G_DEFINE_TYPE_WITH_PRIVATE (NautilusNotificationManager, nautilus_notification_manager, GD_TYPE_NOTIFICATION)
NautilusNotificationManager *
nautilus_notification_manager_new (void)
{
return g_object_new (NAUTILUS_TYPE_NOTIFICATION_MANAGER,
"show-close-button", FALSE,
"timeout", -1,
NULL);
}
void
nautilus_notification_manager_add_notification (NautilusNotificationManager *self,
GtkWidget *notification)
{
gtk_container_add (GTK_CONTAINER (self->priv->grid), notification);
gtk_widget_show_all (GTK_WIDGET (self));
}
void
nautilus_notification_manager_remove_all (NautilusNotificationManager *self)
{
gtk_widget_hide (GTK_WIDGET (self));
gtk_container_foreach (GTK_CONTAINER (self->priv->grid),
(GtkCallback) gtk_widget_destroy,
NULL);
}
static void
nautilus_notification_manager_class_init (NautilusNotificationManagerClass *Klass)
{
}
static void
nautilus_notification_manager_init (NautilusNotificationManager *self)
{
self->priv = nautilus_notification_manager_get_instance_private (self);
gtk_widget_set_halign (GTK_WIDGET (self), GTK_ALIGN_CENTER);
gtk_widget_set_valign (GTK_WIDGET (self), GTK_ALIGN_START);
self->priv->grid = gtk_grid_new ();
gtk_orientable_set_orientation (GTK_ORIENTABLE (self->priv->grid),
GTK_ORIENTATION_VERTICAL);
gtk_grid_set_row_spacing (GTK_GRID (self->priv->grid), 6);
gtk_container_add (GTK_CONTAINER (self), self->priv->grid);
g_signal_connect_swapped (self->priv->grid, "remove",
G_CALLBACK (nautilus_notification_manager_remove_all),
self);
}
/* nautilus-notification-manager.h
*
* Copyright (C) 2015 Carlos Soriano <csoriano@gnome.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef NAUTILUS_NOTIFICATION_MANAGER_H
#define NAUTILUS_NOTIFICATION_MANAGER_H
#include <libgd/gd.h>
G_BEGIN_DECLS
#define NAUTILUS_TYPE_NOTIFICATION_MANAGER (nautilus_notification_manager_get_type())
#define NAUTILUS_NOTIFICATION_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_NOTIFICATION_MANAGER, NautilusNotificationManager))
#define NAUTILUS_NOTIFICATION_MANAGER_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_NOTIFICATION_MANAGER, NautilusNotificationManager const))
#define NAUTILUS_NOTIFICATION_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_NOTIFICATION_MANAGER, NautilusNotificationManagerClass))
#define NAUTILUS_IS_NOTIFICATION_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_NOTIFICATION_MANAGER))
#define NAUTILUS_IS_NOTIFICATION_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_NOTIFICATION_MANAGER))
#define NAUTILUS_NOTIFICATION_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NAUTILUS_TYPE_NOTIFICATION_MANAGER, NautilusNotificationManagerClass))
typedef struct _NautilusNotificationManager NautilusNotificationManager;
typedef struct _NautilusNotificationManagerClass NautilusNotificationManagerClass;
typedef struct _NautilusNotificationManagerPrivate NautilusNotificationManagerPrivate;
struct _NautilusNotificationManager
{
GdNotification parent;
/*< private >*/
NautilusNotificationManagerPrivate *priv;
};
struct _NautilusNotificationManagerClass
{
GdNotificationClass parent;
};
GType nautilus_notification_manager_get_type (void);
NautilusNotificationManager *nautilus_notification_manager_new (void);
void nautilus_notification_manager_add_notification (NautilusNotificationManager *self,
GtkWidget *notification);
void nautilus_notification_manager_remove_all (NautilusNotificationManager *self);
G_END_DECLS
#endif /* NAUTILUS_NOTIFICATION_MANAGER_H */
......@@ -55,7 +55,11 @@ struct NautilusWindowDetails
GtkWidget *main_view;
/* Notifications */
GtkWidget *notification_manager;
GtkWidget *notification_delete;
GtkWidget *notification_delete_label;
GtkWidget *notification_delete_close;
GtkWidget *notification_delete_undo;
guint notification_delete_timeout_id;
/* Toolbar */
GtkWidget *toolbar;
......
......@@ -42,8 +42,6 @@
#include "nautilus-window-slot.h"
#include "nautilus-list-view.h"
#include "nautilus-view.h"
#include "nautilus-notification-manager.h"
#include "nautilus-notification-delete.h"
#include <eel/eel-debug.h>
#include <eel/eel-gtk-extensions.h>
......@@ -95,6 +93,8 @@ static GtkWidget * nautilus_window_ensure_location_entry (NautilusWindow *window
*/
#define UPPER_MOUSE_LIMIT 14
#define NOTIFICATION_TIMEOUT 6 //s
enum {
PROP_DISABLE_CHROME = 1,
NUM_PROPERTIES,
......@@ -1462,16 +1462,101 @@ nautilus_window_ensure_location_entry (NautilusWindow *window)
return location_entry;
}
static void
nautilus_window_on_notification_delete_undo_clicked (GtkWidget *notification,
gpointer user_data)
{
NautilusWindow *window;
window = NAUTILUS_WINDOW (user_data);
if (window->details->notification_delete_timeout_id != 0) {
g_source_remove (window->details->notification_delete_timeout_id);
window->details->notification_delete_timeout_id = 0;
}
gtk_revealer_set_reveal_child (GTK_REVEALER (window->details->notification_delete), FALSE);
nautilus_file_undo_manager_undo (GTK_WINDOW (window));
}
static void
nautilus_window_on_notification_delete_close_clicked (GtkWidget *notification,
gpointer user_data)
{
NautilusWindow *window;
window = NAUTILUS_WINDOW (user_data);
if (window->details->notification_delete_timeout_id != 0) {
g_source_remove (window->details->notification_delete_timeout_id);
window->details->notification_delete_timeout_id = 0;
}
gtk_revealer_set_reveal_child (GTK_REVEALER (window->details->notification_delete), FALSE);
}
static gboolean
nautilus_window_on_notification_delete_timeout (gpointer user_data)
{
NautilusWindow *window;
window = NAUTILUS_WINDOW (user_data);
if (window->details->notification_delete_timeout_id != 0) {
g_source_remove (window->details->notification_delete_timeout_id);
window->details->notification_delete_timeout_id = 0;
}
gtk_revealer_set_reveal_child (GTK_REVEALER (window->details->notification_delete), FALSE);
return FALSE;
}
static char *
nautilus_window_notification_delete_get_label (NautilusFileUndoInfo *undo_info,
GList *files)
{
gchar *file_label;
gchar *markup;
gchar *label;
gint length;
length = g_list_length (files);
if (length == 1) {
file_label = g_file_get_basename (files->data);
markup = g_markup_printf_escaped ("<b>%s</b>", file_label);
label = g_strdup_printf (_("%s deleted"), markup);
} else {
/* Translators: this is the first part of a "%d files deleted" string */
file_label = g_strdup_printf (ngettext ("%d file", "%d files", length), length);
markup = g_markup_printf_escaped ("<b>%s</b>", file_label);
/* Translators: this is the second part of a "%d files deleted" string */
label = g_strdup_printf (ngettext ("%s deleted", "%s deleted", length), markup);
}
g_free (file_label);
g_free (markup);
return label;
}
static void
nautilus_window_on_undo_changed (NautilusFileUndoManager *manager,
NautilusWindow *window)
{
NautilusNotificationDelete *notification;
NautilusFileUndoInfo *undo_info;
NautilusFileUndoManagerState state;
int transition_durantion;
gchar *label;
GList *files;
nautilus_notification_manager_remove_all (NAUTILUS_NOTIFICATION_MANAGER (window->details->notification_manager));
/* Hide it inmediatily so we can animate the new notification. */
transition_durantion = gtk_revealer_get_transition_duration (GTK_REVEALER (window->details->notification_delete));
gtk_revealer_set_transition_duration (GTK_REVEALER (window->details->notification_delete), 0);
gtk_revealer_set_reveal_child (GTK_REVEALER (window->details->notification_delete), FALSE);
gtk_revealer_set_transition_duration (GTK_REVEALER (window->details->notification_delete), transition_durantion);
undo_info = nautilus_file_undo_manager_get_action ();
state = nautilus_file_undo_manager_get_state ();
......@@ -1484,9 +1569,13 @@ nautilus_window_on_undo_changed (NautilusFileUndoManager *manager,
* is not in the this window. This is an easy way to know from which window
* was the delete operation made */
if (g_list_length (files) > 0 && gtk_window_has_toplevel_focus (GTK_WINDOW (window))) {
notification = nautilus_notification_delete_new (window);
nautilus_notification_manager_add_notification (NAUTILUS_NOTIFICATION_MANAGER (window->details->notification_manager),
GTK_WIDGET (notification));
label = nautilus_window_notification_delete_get_label (undo_info, files);
gtk_label_set_markup (GTK_LABEL (window->details->notification_delete_label), label);
gtk_revealer_set_reveal_child (GTK_REVEALER (window->details->notification_delete), TRUE);
window->details->notification_delete_timeout_id = g_timeout_add_seconds (NOTIFICATION_TIMEOUT,
nautilus_window_on_notification_delete_timeout,
window);
g_free (label);
}
g_list_free (files);
}
......@@ -1868,6 +1957,7 @@ nautilus_window_constructed (GObject *self)
GtkWidget *grid;
NautilusWindowSlot *slot;
NautilusApplication *application;
g_autoptr (GtkBuilder) builder;
window = NAUTILUS_WINDOW (self);
......@@ -1907,9 +1997,18 @@ nautilus_window_constructed (GObject *self)
window->details->notebook = create_notebook (window);
nautilus_window_set_initial_window_geometry (window);
window->details->notification_manager = GTK_WIDGET (nautilus_notification_manager_new ());
builder = gtk_builder_new_from_resource ("/org/gnome/nautilus/nautilus-notification-delete.ui");
window->details->notification_delete = GTK_WIDGET (gtk_builder_get_object (builder, "notification_delete"));
window->details->notification_delete_label = GTK_WIDGET (gtk_builder_get_object (builder, "notification_delete_label"));
window->details->notification_delete_close = GTK_WIDGET (gtk_builder_get_object (builder, "notification_delete_close"));
window->details->notification_delete_undo = GTK_WIDGET (gtk_builder_get_object (builder, "notification_delete_undo"));
gtk_overlay_add_overlay (GTK_OVERLAY (window->details->main_view),
window->details->notification_manager);
window->details->notification_delete);
g_signal_connect_object (window->details->notification_delete_close, "clicked",
G_CALLBACK (nautilus_window_on_notification_delete_close_clicked), window, 0);
g_signal_connect_object (window->details->notification_delete_undo, "clicked",
G_CALLBACK (nautilus_window_on_notification_delete_undo_clicked), window, 0);
g_signal_connect_after (nautilus_file_undo_manager_get (), "undo-changed",
G_CALLBACK (nautilus_window_on_undo_changed), self);
......@@ -2037,6 +2136,11 @@ nautilus_window_finalize (GObject *object)
window->details->sidebar_width_handler_id = 0;
}
if (window->details->notification_delete_timeout_id != 0) {
g_source_remove (window->details->notification_delete_timeout_id);
window->details->notification_delete_timeout_id = 0;
}
g_signal_handlers_disconnect_by_func (nautilus_file_undo_manager_get (),
G_CALLBACK (nautilus_window_on_undo_changed),
window);
......
......@@ -10,6 +10,7 @@
<file>nautilus-view-context-menus.xml</file>
<file>nautilus-progress-info-widget.xml</file>
<file>nautilus-move-to-trash-shortcut-changed.ui</file>
<file>nautilus-notification-delete.ui</file>
<file alias="icons/thumbnail_frame.png">../icons/thumbnail_frame.png</file>
<file alias="icons/filmholes.png">../icons/filmholes.png</file>
<file alias="icons/knob.png">../icons/knob.png</file>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment