summaryrefslogtreecommitdiff
path: root/logview/src
diff options
context:
space:
mode:
Diffstat (limited to 'logview/src')
-rw-r--r--logview/src/Makefile.am15
-rw-r--r--logview/src/logview-about.h28
-rw-r--r--logview/src/logview-app.c26
-rw-r--r--logview/src/logview-app.h22
-rw-r--r--logview/src/logview-filter-manager.c30
-rw-r--r--logview/src/logview-filter-manager.h25
-rw-r--r--logview/src/logview-filter.c25
-rw-r--r--logview/src/logview-filter.h25
-rw-r--r--logview/src/logview-findbar.c27
-rw-r--r--logview/src/logview-findbar.h24
-rw-r--r--logview/src/logview-log.c152
-rw-r--r--logview/src/logview-log.h21
-rw-r--r--logview/src/logview-loglist.c25
-rw-r--r--logview/src/logview-loglist.h24
-rw-r--r--logview/src/logview-main.c39
-rw-r--r--logview/src/logview-manager.c21
-rw-r--r--logview/src/logview-manager.h19
-rw-r--r--logview/src/logview-prefs.c22
-rw-r--r--logview/src/logview-prefs.h24
-rw-r--r--logview/src/logview-utils.c24
-rw-r--r--logview/src/logview-utils.h22
-rw-r--r--logview/src/logview-window.c344
-rw-r--r--logview/src/logview-window.h16
-rw-r--r--logview/src/tests/Makefile.am15
-rw-r--r--logview/src/tests/test-reader.c16
25 files changed, 556 insertions, 475 deletions
diff --git a/logview/src/Makefile.am b/logview/src/Makefile.am
index ec90546f..309939d1 100644
--- a/logview/src/Makefile.am
+++ b/logview/src/Makefile.am
@@ -1,3 +1,18 @@
+# This file is part of MATE Utils.
+#
+# MATE Utils 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.
+#
+# MATE Utils 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 MATE Utils. If not, see <https://www.gnu.org/licenses/>.
+
SUBDIRS = tests
AM_CPPFLAGS = \
diff --git a/logview/src/logview-about.h b/logview/src/logview-about.h
index 758679cd..ebeaaa77 100644
--- a/logview/src/logview-about.h
+++ b/logview/src/logview-about.h
@@ -1,22 +1,21 @@
-/* logview-about.h - authors and contributors information
- *
- * Copyright (C) 2004 Vincent Noel <[email protected]>
+/* Copyright (C) 2004 Vincent Noel <[email protected]>
* Copyright (C) 2008 Cosimo Cecchi <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * This file is part of MATE Utils.
*
- * 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.
+ * MATE Utils 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,
+ * MATE Utils 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.
+ * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
+ * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef __LOGVIEW_ABOUT_H__
@@ -56,8 +55,7 @@ static const char * logview_about_license[] = {
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the "
"GNU General Public License for more details."),
N_("You should have received a copy of the GNU General Public License "
- "along with this program; if not, write to the Free Software Foundation, Inc., "
- "51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.")
+ "along with this program. If not, see <https://www.gnu.org/licenses/>.")
};
/* translator credits */
diff --git a/logview/src/logview-app.c b/logview/src/logview-app.c
index 4de11571..ba9bec7b 100644
--- a/logview/src/logview-app.c
+++ b/logview/src/logview-app.c
@@ -1,25 +1,23 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
-/* logview-app.c - logview application singleton
+/* Copyright (C) 2008 Cosimo Cecchi <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
*
- * Copyright (C) 2008 Cosimo Cecchi <[email protected]>
+ * This file is part of MATE Utils.
*
- * 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.
+ * MATE Utils 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,
+ * MATE Utils 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.
+ * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>.
*/
-/* logview-app.c */
-
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -187,7 +185,7 @@ enumerate_next_files_async_cb (GObject *source,
continue;
}
- if (type != (G_FILE_TYPE_REGULAR || G_FILE_TYPE_SYMBOLIC_LINK) ||
+ if (((type != G_FILE_TYPE_REGULAR) && (type != G_FILE_TYPE_SYMBOLIC_LINK)) ||
!g_content_type_is_a (content_type, "text/plain"))
{
g_object_unref (info);
diff --git a/logview/src/logview-app.h b/logview/src/logview-app.h
index e1a5d021..3ea41675 100644
--- a/logview/src/logview-app.h
+++ b/logview/src/logview-app.h
@@ -1,21 +1,21 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
-/* logview-app.h - logview application singleton
+/* Copyright (C) 2008 Cosimo Cecchi <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
*
- * Copyright (C) 2008 Cosimo Cecchi <[email protected]>
+ * This file is part of MATE Utils.
*
- * 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.
+ * MATE Utils 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,
+ * MATE Utils 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.
+ * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef __LOGVIEW_APP_H__
diff --git a/logview/src/logview-filter-manager.c b/logview/src/logview-filter-manager.c
index d411029d..315070e0 100644
--- a/logview/src/logview-filter-manager.c
+++ b/logview/src/logview-filter-manager.c
@@ -1,20 +1,21 @@
/*-*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
-/*
- * mate-utils
- * Copyright (C) Johannes Schmid 2009 <[email protected]>
+/* Copyright (C) Johannes Schmid 2009 <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
*
- * mate-utils 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 3 of the License, or
+ * This file is part of MATE Utils.
+ *
+ * MATE Utils 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.
*
- * mate-utils 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.
+ * MATE Utils 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/>.
+ * You should have received a copy of the GNU General Public License
+ * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
@@ -329,8 +330,9 @@ run_add_edit_dialog (LogviewFilterManager *manager, LogviewFilter *filter)
g_object_set_data_full (G_OBJECT (manager), "old_name", name, g_free);
- g_signal_connect (G_OBJECT (dialog), "response",
- G_CALLBACK (on_dialog_add_edit_reponse), manager);
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (on_dialog_add_edit_reponse),
+ manager);
gtk_window_set_transient_for (GTK_WINDOW (dialog),
GTK_WINDOW (manager));
gtk_window_set_modal (GTK_WINDOW (dialog),
diff --git a/logview/src/logview-filter-manager.h b/logview/src/logview-filter-manager.h
index 864ec94c..6b6d1941 100644
--- a/logview/src/logview-filter-manager.h
+++ b/logview/src/logview-filter-manager.h
@@ -1,20 +1,21 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
-/*
- * mate-utils
- * Copyright (C) Johannes Schmid 2009 <[email protected]>
+/* Copyright (C) Johannes Schmid 2009 <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
*
- * mate-utils 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 3 of the License, or
+ * This file is part of MATE Utils.
+ *
+ * MATE Utils 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.
*
- * mate-utils 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.
+ * MATE Utils 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/>.
+ * You should have received a copy of the GNU General Public License
+ * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef _LOGVIEW_FILTER_MANAGER_H_
diff --git a/logview/src/logview-filter.c b/logview/src/logview-filter.c
index 47ac9878..7dd8bf29 100644
--- a/logview/src/logview-filter.c
+++ b/logview/src/logview-filter.c
@@ -1,20 +1,21 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
-/*
- * mate-utils
- * Copyright (C) Johannes Schmid 2009 <[email protected]>
+/* Copyright (C) Johannes Schmid 2009 <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
*
- * mate-utils 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 3 of the License, or
+ * This file is part of MATE Utils.
+ *
+ * MATE Utils 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.
*
- * mate-utils 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.
+ * MATE Utils 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/>.
+ * You should have received a copy of the GNU General Public License
+ * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
diff --git a/logview/src/logview-filter.h b/logview/src/logview-filter.h
index a5414259..da4836b4 100644
--- a/logview/src/logview-filter.h
+++ b/logview/src/logview-filter.h
@@ -1,20 +1,21 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
-/*
- * mate-utils
- * Copyright (C) Johannes Schmid 2009 <[email protected]>
+/* Copyright (C) Johannes Schmid 2009 <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
*
- * mate-utils 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 3 of the License, or
+ * This file is part of MATE Utils.
+ *
+ * MATE Utils 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.
*
- * mate-utils 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.
+ * MATE Utils 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/>.
+ * You should have received a copy of the GNU General Public License
+ * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef _LOGVIEW_FILTER_H_
diff --git a/logview/src/logview-findbar.c b/logview/src/logview-findbar.c
index 56141752..33ea4958 100644
--- a/logview/src/logview-findbar.c
+++ b/logview/src/logview-findbar.c
@@ -1,22 +1,22 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
-/* logview-findbar.c - find toolbar for logview
- *
- * Copyright (C) 2005 Vincent Noel <[email protected]>
+/* Copyright (C) 2005 Vincent Noel <[email protected]>
* Copyright (C) 2008 Cosimo Cecchi <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * This file is part of MATE Utils.
*
- * 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.
+ * MATE Utils 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,
+ * MATE Utils 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.
+ * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
@@ -197,7 +197,8 @@ logview_findbar_init (LogviewFindbar *findbar)
gtk_widget_show_all (GTK_WIDGET (priv->forward_button));
/* clear button */
- priv->clear_button = gtk_tool_button_new_from_stock ("gtk-clear");
+ w = gtk_image_new_from_icon_name ("edit-clear-all", GTK_ICON_SIZE_BUTTON);
+ priv->clear_button = gtk_tool_button_new (w, NULL);
gtk_tool_item_set_tooltip_text (priv->clear_button,
_("Clear the search string"));
gtk_toolbar_insert (gtoolbar, priv->clear_button, -1);
diff --git a/logview/src/logview-findbar.h b/logview/src/logview-findbar.h
index 89c65249..6805b12b 100644
--- a/logview/src/logview-findbar.h
+++ b/logview/src/logview-findbar.h
@@ -1,21 +1,21 @@
-/* logview-findbar.h - find toolbar for logview
- *
- * Copyright (C) 2004 Vincent Noel <[email protected]>
+/* Copyright (C) 2004 Vincent Noel <[email protected]>
* Copyright (C) 2008 Cosimo Cecchi <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * This file is part of MATE Utils.
*
- * 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.
+ * MATE Utils 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,
+ * MATE Utils 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.
+ * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef __LOGVIEW_FINDBAR_H__
diff --git a/logview/src/logview-log.c b/logview/src/logview-log.c
index 0e996fd1..1e236c52 100644
--- a/logview/src/logview-log.c
+++ b/logview/src/logview-log.c
@@ -1,26 +1,27 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
-/* logview-log.c - object representation of a logfile
- *
- * Copyright (C) 1998 Cesar Miquel <[email protected]>
+/* Copyright (C) 1998 Cesar Miquel <[email protected]>
* Copyright (C) 2008 Cosimo Cecchi <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * This file is part of MATE Utils.
*
- * 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.
+ * MATE Utils 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,
+ * MATE Utils 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, write to the Free Software
- * Foundation, Inc., 551 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
+ * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>.
*/
-#include "config.h"
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <glib.h>
#include <glib/gi18n.h>
@@ -63,17 +64,14 @@ struct _LogviewLogPrivate {
typedef struct {
LogviewLog *log;
- GError *err;
LogviewCreateCallback callback;
gpointer user_data;
} LoadJob;
typedef struct {
LogviewLog *log;
- GError *err;
const char **lines;
GSList *new_days;
- GCancellable *cancellable;
LogviewNewLinesCallback callback;
gpointer user_data;
} NewLinesJob;
@@ -236,34 +234,35 @@ add_new_days_to_cache (LogviewLog *log, const char **new_lines, guint lines_offs
return new_days;
}
-static gboolean
-new_lines_job_done (gpointer data)
+static void
+new_lines_job_done (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
{
- NewLinesJob *job = data;
+ NewLinesJob *job = user_data;
+ g_autoptr(GError) error = NULL;
+ gboolean ret;
- if (job->err) {
- job->callback (job->log, NULL, NULL, job->err, job->user_data);
- g_error_free (job->err);
+ ret = g_task_propagate_boolean (G_TASK (res), &error);
+ if (!ret) {
+ job->callback (job->log, NULL, NULL, error, job->user_data);
} else {
- job->callback (job->log, job->lines, job->new_days, job->err, job->user_data);
+ job->callback (job->log, job->lines, job->new_days, error, job->user_data);
}
- g_clear_object (&job->cancellable);
-
g_slist_free_full (job->new_days, (GDestroyNotify) logview_utils_day_free);
/* drop the reference we acquired before */
g_object_unref (job->log);
g_slice_free (NewLinesJob, job);
-
- return FALSE;
}
-static gboolean
-do_read_new_lines (GIOSchedulerJob *io_job,
- GCancellable *cancellable,
- gpointer user_data)
+static void
+do_read_new_lines (GTask *task,
+ gpointer source_object,
+ gpointer user_data,
+ GCancellable *cancellable)
{
/* this runs in a separate thread */
NewLinesJob *job = user_data;
@@ -286,7 +285,7 @@ do_read_new_lines (GIOSchedulerJob *io_job,
g_ptr_array_remove_index (lines, lines->len - 1);
while ((line = g_data_input_stream_read_line (log->priv->stream, NULL,
- job->cancellable, &err)) != NULL)
+ cancellable, &err)) != NULL)
{
g_ptr_array_add (lines, (gpointer) line);
}
@@ -295,8 +294,7 @@ do_read_new_lines (GIOSchedulerJob *io_job,
g_ptr_array_add (lines, NULL);
if (err) {
- job->err = err;
- goto out;
+ g_task_return_error (task, err);
}
log->priv->has_new_lines = FALSE;
@@ -308,23 +306,23 @@ do_read_new_lines (GIOSchedulerJob *io_job,
job->new_days = add_new_days_to_cache (log, job->lines, log->priv->lines_no);
log->priv->lines_no = (lines->len - 1);
-out:
- g_io_scheduler_job_send_to_mainloop_async (io_job,
- new_lines_job_done,
- job, NULL);
- return FALSE;
+ g_task_return_boolean (task, TRUE);
}
-static gboolean
-log_load_done (gpointer user_data)
+static void
+log_load_done (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
{
LoadJob *job = user_data;
+ g_autoptr(GError) error = NULL;
+ gboolean ret;
- if (job->err) {
- /* the callback will have NULL as log, and the error set */
+ ret = g_task_propagate_boolean (G_TASK (res), &error);
+
+ if (!ret) {
g_object_unref (job->log);
- job->callback (NULL, job->err, job->user_data);
- g_error_free (job->err);
+ job->callback (NULL, error, job->user_data);
} else {
job->callback (job->log, NULL, job->user_data);
setup_file_monitor (job->log);
@@ -332,7 +330,6 @@ log_load_done (gpointer user_data)
g_slice_free (LoadJob, job);
- return FALSE;
}
#ifdef HAVE_ZLIB
@@ -591,11 +588,11 @@ create_zlib_error (void)
}
#endif /* HAVE_ZLIB */
-
-static gboolean
-log_load (GIOSchedulerJob *io_job,
- GCancellable *cancellable,
- gpointer user_data)
+static void
+log_load (GTask *task,
+ gpointer source_object,
+ gpointer user_data,
+ GCancellable *cancellable)
{
/* this runs in a separate i/o thread */
LoadJob *job = user_data;
@@ -642,7 +639,7 @@ log_load (GIOSchedulerJob *io_job,
is_archive = g_content_type_equals (content_type, "application/x-gzip");
- if (type != (G_FILE_TYPE_REGULAR || G_FILE_TYPE_SYMBOLIC_LINK) ||
+ if (((type != G_FILE_TYPE_REGULAR) && (type != G_FILE_TYPE_SYMBOLIC_LINK)) ||
(!g_content_type_is_a (content_type, "text/plain") && !is_archive))
{
err = g_error_new_literal (LOGVIEW_ERROR_QUARK, LOGVIEW_ERROR_NOT_A_LOG,
@@ -653,18 +650,18 @@ log_load (GIOSchedulerJob *io_job,
}
log->priv->file_size = g_file_info_get_size (info);
- #if GLIB_CHECK_VERSION(2,61,2)
- GDateTime *file_dt;
- gint64 t;
- file_dt = g_file_info_get_modification_date_time (info);
- t = g_date_time_to_unix (file_dt);
- g_date_time_unref (file_dt);
- log->priv->file_time = t;
- #else
- GTimeVal time_val;
- g_file_info_get_modification_time (info, &time_val);
- log->priv->file_time = time_val.tv_sec;
- #endif
+#if GLIB_CHECK_VERSION(2,61,2)
+ GDateTime *file_dt;
+ gint64 t;
+ file_dt = g_file_info_get_modification_date_time (info);
+ t = g_date_time_to_unix (file_dt);
+ g_date_time_unref (file_dt);
+ log->priv->file_time = t;
+#else
+ GTimeVal time_val;
+ g_file_info_get_modification_time (info, &time_val);
+ log->priv->file_time = time_val.tv_sec;
+#endif
log->priv->display_name = g_strdup (g_file_info_get_display_name (info));
@@ -771,13 +768,10 @@ log_load (GIOSchedulerJob *io_job,
out:
if (err) {
- job->err = err;
+ g_task_return_error (task, err);
}
- g_io_scheduler_job_send_to_mainloop_async (io_job,
- log_load_done,
- job, NULL);
- return FALSE;
+ g_task_return_boolean (task, TRUE);
}
static void
@@ -785,17 +779,17 @@ log_setup_load (LogviewLog *log, LogviewCreateCallback callback,
gpointer user_data)
{
LoadJob *job;
+ GTask *task;
job = g_slice_new0 (LoadJob);
job->callback = callback;
job->user_data = user_data;
job->log = log;
- job->err = NULL;
- /* push the loading job into another thread */
- g_io_scheduler_push_job (log_load,
- job,
- NULL, 0, NULL);
+ task = g_task_new (log, NULL, log_load_done, job);
+ g_task_set_task_data (task, job, NULL);
+ g_task_run_in_thread (task, log_load);
+ g_object_unref (task);
}
/* public methods */
@@ -807,22 +801,20 @@ logview_log_read_new_lines (LogviewLog *log,
gpointer user_data)
{
NewLinesJob *job;
+ GTask *task;
/* initialize the job struct with sensible values */
job = g_slice_new0 (NewLinesJob);
job->callback = callback;
job->user_data = user_data;
- job->cancellable = (cancellable != NULL) ? g_object_ref (cancellable) : NULL;
job->log = g_object_ref (log);
- job->err = NULL;
job->lines = NULL;
job->new_days = NULL;
- /* push the fetching job into another thread */
- g_io_scheduler_push_job (do_read_new_lines,
- job,
- NULL, 0,
- job->cancellable);
+ task = g_task_new (log, cancellable, new_lines_job_done, job);
+ g_task_set_task_data (task, job, NULL);
+ g_task_run_in_thread (task, do_read_new_lines);
+ g_object_unref (task);
}
void
diff --git a/logview/src/logview-log.h b/logview/src/logview-log.h
index 5c359195..d0ae3ef4 100644
--- a/logview/src/logview-log.h
+++ b/logview/src/logview-log.h
@@ -1,22 +1,21 @@
-/* logview-log.h - object representation of a logfile
- *
- * Copyright (C) 1998 Cesar Miquel <[email protected]>
+/* Copyright (C) 1998 Cesar Miquel <[email protected]>
* Copyright (C) 2008 Cosimo Cecchi <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * This file is part of MATE Utils.
*
- * 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.
+ * MATE Utils 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,
+ * MATE Utils 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, write to the Free Software
- * Foundation, Inc., 551 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
+ * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>.
*/
/* logview-log.h */
diff --git a/logview/src/logview-loglist.c b/logview/src/logview-loglist.c
index 611f455a..28eebdfa 100644
--- a/logview/src/logview-loglist.c
+++ b/logview/src/logview-loglist.c
@@ -1,22 +1,22 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
-/* logview-loglist.c - displays a list of the opened logs
- *
- * Copyright (C) 2005 Vincent Noel <[email protected]>
+/* Copyright (C) 2005 Vincent Noel <[email protected]>
* Copyright (C) 2008 Cosimo Cecchi <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * This file is part of MATE Utils.
*
- * 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.
+ * MATE Utils 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,
+ * MATE Utils 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.
+ * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
@@ -169,7 +169,6 @@ log_changed_cb (LogviewLog *log,
gtk_tree_iter_free (iter);
}
-
static void
tree_selection_changed_cb (GtkTreeSelection *selection,
gpointer user_data)
diff --git a/logview/src/logview-loglist.h b/logview/src/logview-loglist.h
index ac6c9544..4e3d1926 100644
--- a/logview/src/logview-loglist.h
+++ b/logview/src/logview-loglist.h
@@ -1,21 +1,21 @@
-/* logview-loglist.h - displays a list of the opened logs
- *
- * Copyright (C) 2005 Vincent Noel <[email protected]>
+/* Copyright (C) 2005 Vincent Noel <[email protected]>
* Copyright (C) 2008 Cosimo Cecchi <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * This file is part of MATE Utils.
*
- * 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.
+ * MATE Utils 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,
+ * MATE Utils 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.
+ * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef __LOGVIEW_LOGLIST_H__
diff --git a/logview/src/logview-main.c b/logview/src/logview-main.c
index 7eb43b06..93c7e590 100644
--- a/logview/src/logview-main.c
+++ b/logview/src/logview-main.c
@@ -1,25 +1,27 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
-/* logview-main.c - logview main
- *
- * Copyright (C) 2005 Vincent Noel <[email protected]>
+/* Copyright (C) 2005 Vincent Noel <[email protected]>
* Copyright (C) 2008 Cosimo Cecchi <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * This file is part of MATE Utils.
*
- * 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.
+ * MATE Utils 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,
+ * MATE Utils 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.
+ * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>.
*/
-#include "config.h"
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdlib.h>
@@ -43,8 +45,9 @@ app_quit_cb (LogviewApp *app,
static void
logview_show_version_and_quit (void)
{
- g_print ("%s - Version %s\n"
- "Copyright (C) 2004-2008 Vincent Noel, Cosimo Cecchi and others.\n",
+ g_print (_("%s - Version %s\n"
+ "Copyright (C) 2004-2008 Vincent Noel, Cosimo Cecchi and others.\n"
+ "Copyright (C) 2011-2021 MATE developers.\n"),
g_get_application_name (),
VERSION);
@@ -61,11 +64,13 @@ create_option_context (void)
logview_show_version_and_quit, N_("Show the application's version"), NULL },
{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &log_files,
NULL, N_("[LOGFILE...]") },
- { NULL },
+ { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL },
};
context = g_option_context_new (_(" - Browse and monitor logs"));
+#ifdef ENABLE_NLS
g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
g_option_context_set_ignore_unknown_options (context, TRUE);
g_option_context_add_group (context, gtk_get_option_group (TRUE));
@@ -80,9 +85,11 @@ main (int argc, char *argv[])
GOptionContext *context;
LogviewApp *app;
+#ifdef ENABLE_NLS
bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
+#endif /* ENABLE_NLS */
context = create_option_context ();
diff --git a/logview/src/logview-manager.c b/logview/src/logview-manager.c
index 01beb06b..3fce939e 100644
--- a/logview/src/logview-manager.c
+++ b/logview/src/logview-manager.c
@@ -1,26 +1,23 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
-/* logview-manager.c - manager for the opened log objects
+/* Copyright (C) 2008 Cosimo Cecchi <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
*
- * Copyright (C) 2008 Cosimo Cecchi <[email protected]>
+ * This file is part of MATE Utils.
*
- * 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.
+ * MATE Utils 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,
+ * MATE Utils 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, write to the Free Software
- * Foundation, Inc., 551 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
+ * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>.
*/
-/* logview-manager.c */
-
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
diff --git a/logview/src/logview-manager.h b/logview/src/logview-manager.h
index b9444323..6017619a 100644
--- a/logview/src/logview-manager.h
+++ b/logview/src/logview-manager.h
@@ -1,21 +1,20 @@
-/* logview-manager.h - manager for the opened log objects
+/* Copyright (C) 2008 Cosimo Cecchi <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
*
- * Copyright (C) 2008 Cosimo Cecchi <[email protected]>
+ * This file is part of MATE Utils.
*
- * 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.
+ * MATE Utils 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,
+ * MATE Utils 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, write to the Free Software
- * Foundation, Inc., 551 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
+ * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>.
*/
/* logview-manager.h */
diff --git a/logview/src/logview-prefs.c b/logview/src/logview-prefs.c
index 6253120a..02fca06f 100644
--- a/logview/src/logview-prefs.c
+++ b/logview/src/logview-prefs.c
@@ -1,28 +1,28 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
-/* logview-prefs.c - logview user preferences handling
+/* Copyright (C) 1998 Cesar Miquel <[email protected]>
+ * Copyright (C) 2004 Vincent Noel
+ * Copyright (C) 2006 Emmanuele Bassi
+ * Copyright (C) 2008 Cosimo Cecchi <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
*
- * Copyright (C) 1998 Cesar Miquel <[email protected]>
- * Copyright (C) 2004 Vincent Noel
- * Copyright (C) 2006 Emmanuele Bassi
- * Copyright (C) 2008 Cosimo Cecchi <[email protected]>
+ * This file is part of MATE Utils.
*
- * This program is free software; you can redistribute it and/or modify
+ * MATE Utils 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
+ * 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,
+ * MATE Utils 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
#endif
#include <sys/stat.h>
diff --git a/logview/src/logview-prefs.h b/logview/src/logview-prefs.h
index bc9c6608..6d96aff2 100644
--- a/logview/src/logview-prefs.h
+++ b/logview/src/logview-prefs.h
@@ -1,21 +1,21 @@
-/* logview-prefs.h - logview user preferences handling
- *
- * Copyright (C) 2004 Vincent Noel <[email protected]>
+/* Copyright (C) 2004 Vincent Noel <[email protected]>
* Copyright (C) 2008 Cosimo Cecchi <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * This file is part of MATE Utils.
*
- * 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.
+ * MATE Utils 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,
+ * MATE Utils 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.
+ * 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef __LOGVIEW_PREFS_H__
diff --git a/logview/src/logview-utils.c b/logview/src/logview-utils.c
index 3c2629e9..a2de5fdb 100644
--- a/logview/src/logview-utils.c
+++ b/logview/src/logview-utils.c
@@ -1,22 +1,22 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
-/* logview-utils.c - misc logview utilities
- *
- * Copyright (C) 1998 Cesar Miquel <[email protected]>
+/* Copyright (C) 1998 Cesar Miquel <[email protected]>
* Copyright (C) 2008 Cosimo Cecchi <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * This file is part of MATE Utils.
*
- * 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.
+ * MATE Utils 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,
+ * MATE Utils 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, write to the Free Software
- * Foundation, Inc., 551 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
@@ -270,9 +270,7 @@ log_read_dates (const char **buffer_lines, time_t current)
}
}
- if (date_string) {
- g_free (date_string);
- }
+ g_free (date_string);
/* sort the days in chronological order */
days = g_slist_sort (days, days_compare);
diff --git a/logview/src/logview-utils.h b/logview/src/logview-utils.h
index 27242917..c6fee29e 100644
--- a/logview/src/logview-utils.h
+++ b/logview/src/logview-utils.h
@@ -1,21 +1,21 @@
-/* logview-utils.h - misc logview utilities
- *
- * Copyright (C) 1998 Cesar Miquel <[email protected]>
+/* Copyright (C) 1998 Cesar Miquel <[email protected]>
* Copyright (C) 2008 Cosimo Cecchi <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * This file is part of MATE Utils.
*
- * 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.
+ * MATE Utils 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,
+ * MATE Utils 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, write to the Free Software
- * Foundation, Inc., 551 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef __LOGVIEW_UTILS_H__
@@ -37,4 +37,4 @@ Day * logview_utils_day_copy (Day *day);
GSList * logview_utils_day_list_copy (GSList *days);
-#endif /* __LOGVIEW_UTILS_H__ */ \ No newline at end of file
+#endif /* __LOGVIEW_UTILS_H__ */
diff --git a/logview/src/logview-window.c b/logview/src/logview-window.c
index 9e5582f5..1933e5a3 100644
--- a/logview/src/logview-window.c
+++ b/logview/src/logview-window.c
@@ -1,25 +1,28 @@
/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
-/* logview-window.c - main window of logview
+/* Copyright (C) 1998 Cesar Miquel <[email protected]>
+ * Copyright (C) 2008 Cosimo Cecchi <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
*
- * Copyright (C) 1998 Cesar Miquel <[email protected]>
- * Copyright (C) 2008 Cosimo Cecchi <[email protected]>
+ * This file is part of MATE Utils.
*
- * This program is free software; you can redistribute it and/or modify
+ * MATE Utils 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
+ * 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,
+ * MATE Utils 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>.
*/
+#ifdef HAVE_CONFIG_H
#include <config.h>
+#endif
+
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
@@ -40,9 +43,9 @@
#define SEARCH_END_MARK "lw-search-end-mark"
struct _LogviewWindowPrivate {
- GtkUIManager *ui_manager;
- GtkActionGroup *action_group;
- GtkActionGroup *filter_action_group;
+ GtkBuilder *ui_manager;
+ GActionGroup *action_group;
+ GActionGroup *filter_action_group;
GtkWidget *find_bar;
GtkWidget *loglist;
@@ -69,7 +72,6 @@ struct _LogviewWindowPrivate {
GCancellable *read_cancellable;
- guint filter_merge_id;
GList *active_filters;
gboolean matches_only;
};
@@ -195,6 +197,18 @@ _gtk_text_buffer_apply_tag_to_rectangle (GtkTextBuffer *buffer, int line_start,
}
static void
+activate_toggle (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ GVariant *state;
+
+ state = g_action_get_state (G_ACTION (action));
+ g_action_change_state (G_ACTION (action), g_variant_new_boolean (!g_variant_get_boolean (state)));
+ g_variant_unref (state);
+}
+
+static void
logview_update_statusbar (LogviewWindow *logview, LogviewLog *active)
{
GDateTime *date_time;
@@ -313,8 +327,12 @@ out:
}
static void
-logview_open_log (GtkAction *action, LogviewWindow *logview)
+logview_open_log (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+
{
+ LogviewWindow *logview = user_data;
static GtkWidget *chooser = NULL;
char *active;
@@ -342,18 +360,24 @@ logview_open_log (GtkAction *action, LogviewWindow *logview)
}
static void
-logview_close_log (GtkAction *action, LogviewWindow *logview)
+logview_close_log (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ LogviewWindow *logview = user_data;
+
findbar_close_cb (LOGVIEW_FINDBAR (logview->priv->find_bar), logview);
logview_manager_close_active_log (logview->priv->manager);
}
static void
-logview_help (GtkAction *action, GtkWidget *parent_window)
+logview_help (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
GError *error = NULL;
- gtk_show_uri_on_window (GTK_WINDOW (parent_window),
+ gtk_show_uri_on_window (GTK_WINDOW (user_data),
"help:mate-system-log", gtk_get_current_event_time (),
&error);
@@ -364,29 +388,44 @@ logview_help (GtkAction *action, GtkWidget *parent_window)
}
static void
-logview_bigger_text (GtkAction *action, LogviewWindow *logview)
+logview_bigger_text (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ LogviewWindow *logview = user_data;
+
logview->priv->fontsize = MIN (logview->priv->fontsize + 1, 24);
logview_set_fontsize (logview, TRUE);
}
static void
-logview_smaller_text (GtkAction *action, LogviewWindow *logview)
+logview_smaller_text (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ LogviewWindow *logview = user_data;
+
logview->priv->fontsize = MAX (logview->priv->fontsize-1, 6);
logview_set_fontsize (logview, TRUE);
}
static void
-logview_normal_text (GtkAction *action, LogviewWindow *logview)
+logview_normal_text (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ LogviewWindow *logview = user_data;
+
logview->priv->fontsize = logview->priv->original_fontsize;
logview_set_fontsize (logview, TRUE);
}
static void
-logview_select_all (GtkAction *action, LogviewWindow *logview)
+logview_select_all (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ LogviewWindow *logview = user_data;
GtkTextIter start, end;
GtkTextBuffer *buffer;
@@ -399,8 +438,11 @@ logview_select_all (GtkAction *action, LogviewWindow *logview)
}
static void
-logview_copy (GtkAction *action, LogviewWindow *logview)
+logview_copy (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ LogviewWindow *logview = user_data;
GtkTextBuffer *buffer;
GtkClipboard *clipboard;
@@ -561,8 +603,12 @@ findbar_text_changed_cb (LogviewFindbar *findbar,
}
static void
-logview_search (GtkAction *action, LogviewWindow *logview)
+logview_search (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ LogviewWindow *logview = user_data;
+
logview_findbar_open (LOGVIEW_FINDBAR (logview->priv->find_bar));
}
@@ -629,15 +675,14 @@ filter_remove (LogviewWindow *logview, LogviewFilter *filter)
}
static void
-on_filter_toggled (GtkToggleAction *action, LogviewWindow *logview)
+on_filter_toggled (GtkCheckMenuItem *item, LogviewWindow *logview)
{
LogviewWindowPrivate *priv = logview_window_get_instance_private (logview);
const gchar* name;
LogviewFilter *filter;
- name = gtk_action_get_name (GTK_ACTION (action));
-
- if (gtk_toggle_action_get_active (action)) {
+ name = gtk_menu_item_get_label (GTK_MENU_ITEM (item));
+ if (gtk_check_menu_item_get_active (item)) {
priv->active_filters = g_list_append (priv->active_filters,
logview_prefs_get_filter (priv->prefs,
name));
@@ -650,76 +695,66 @@ on_filter_toggled (GtkToggleAction *action, LogviewWindow *logview)
filter_remove (logview, filter);
}
}
+static void remove_all_widget (GtkWidget *widget, gpointer filter_menu)
+{
+ gtk_container_remove (GTK_CONTAINER (filter_menu), widget);
+}
-#define FILTER_PLACEHOLDER "/LogviewMenu/FilterMenu/PlaceholderFilters"
static void
update_filter_menu (LogviewWindow *window)
{
LogviewWindowPrivate *priv;
- GtkUIManager* ui;
- GList *actions, *l;
- guint id;
+ GtkWidget *filter_menu;
+ char **actions;
+ int i = 0;
+ GList *l;
GList *filters;
GtkTextTagTable *table;
GtkTextTag *tag;
- GtkToggleAction *action;
+ GSimpleAction *action;
gchar* name;
priv = logview_window_get_instance_private (window);
- ui = priv->ui_manager;
g_return_if_fail (priv->filter_action_group != NULL);
table = priv->tag_table;
- if (priv->filter_merge_id != 0) {
- gtk_ui_manager_remove_ui (ui,
- priv->filter_merge_id);
- }
+ actions = g_action_group_list_actions (priv->filter_action_group);
+ filter_menu = (GtkWidget *)gtk_builder_get_object (priv->ui_manager, "filter_menu");
- actions = gtk_action_group_list_actions (priv->filter_action_group);
-
- for (l = actions; l != NULL; l = g_list_next (l)) {
- tag = gtk_text_tag_table_lookup (table, gtk_action_get_name (GTK_ACTION (l->data)));
+ while (actions[i] != NULL) {
+ tag = gtk_text_tag_table_lookup (table, actions[i]);
gtk_text_tag_table_remove (table, tag);
-
- g_signal_handlers_disconnect_by_func (GTK_ACTION (l->data),
- G_CALLBACK (on_filter_toggled),
- window);
- gtk_action_group_remove_action (priv->filter_action_group,
- GTK_ACTION (l->data));
+ g_action_map_remove_action (G_ACTION_MAP (priv->filter_action_group), actions[i]);
+ i++;
}
- g_list_free (actions);
-
+ g_strfreev (actions);
+ gtk_container_foreach (GTK_CONTAINER (filter_menu), remove_all_widget, filter_menu);
filters = logview_prefs_get_filters (logview_prefs_get ());
- id = (g_list_length (filters) > 0) ? gtk_ui_manager_new_merge_id (ui) : 0;
-
for (l = filters; l != NULL; l = g_list_next (l)) {
g_object_get (l->data, "name", &name, NULL);
+ GtkWidget *item;
+ item = gtk_check_menu_item_new_with_label (name);
+ gtk_container_add (GTK_CONTAINER (filter_menu), item);
+ gtk_widget_show_all (filter_menu);
+ action = g_simple_action_new (name, NULL);;
+ g_action_map_add_action (G_ACTION_MAP (priv->filter_action_group), G_ACTION (action));
+ gtk_text_tag_table_add (table,
+ logview_filter_get_tag (LOGVIEW_FILTER (l->data)));
- action = gtk_toggle_action_new (name, name, NULL, NULL);
- gtk_action_group_add_action (priv->filter_action_group,
- GTK_ACTION (action));
-
- g_signal_connect (action,
+ g_signal_connect (item,
"toggled",
G_CALLBACK (on_filter_toggled),
window);
-
- gtk_ui_manager_add_ui (ui, id, FILTER_PLACEHOLDER,
- name, name, GTK_UI_MANAGER_MENUITEM, FALSE);
- gtk_text_tag_table_add (table,
- logview_filter_get_tag (LOGVIEW_FILTER (l->data)));
-
g_object_unref (action);
g_free(name);
}
g_list_free (filters);
- priv->filter_merge_id = id;
}
static void
@@ -734,7 +769,9 @@ on_logview_filter_manager_response (GtkDialog *dialog,
}
static void
-logview_manage_filters (GtkAction *action, LogviewWindow *logview)
+logview_manage_filters (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
GtkWidget *manager;
@@ -742,15 +779,17 @@ logview_manage_filters (GtkAction *action, LogviewWindow *logview)
g_signal_connect (manager, "response",
G_CALLBACK (on_logview_filter_manager_response),
- logview);
+ user_data);
gtk_window_set_transient_for (GTK_WINDOW (manager),
- GTK_WINDOW (logview));
+ GTK_WINDOW (user_data));
gtk_widget_show (GTK_WIDGET (manager));
}
static void
-logview_about (GtkWidget *widget, GtkWidget *window)
+logview_about (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer window)
{
g_return_if_fail (GTK_IS_WINDOW (window));
@@ -769,7 +808,7 @@ logview_about (GtkWidget *widget, GtkWidget *window)
"version", VERSION,
"title", _("About System Log Viewer"),
"copyright", _("Copyright \xc2\xa9 1998-2008 Free Software Foundation, Inc.\n"
- "Copyright \xc2\xa9 2011-2020 MATE developers"),
+ "Copyright \xc2\xa9 2011-2021 MATE developers"),
"license", license_trans,
"wrap-license", TRUE,
"comments", _("View, monitor or analyze your system logs in a gradual manner."),
@@ -786,8 +825,12 @@ logview_about (GtkWidget *widget, GtkWidget *window)
}
static void
-logview_toggle_statusbar (GtkAction *action, LogviewWindow *logview)
+logview_toggle_statusbar (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ LogviewWindow *logview = user_data;
+
if (gtk_widget_get_visible (logview->priv->statusbar))
gtk_widget_hide (logview->priv->statusbar);
else
@@ -795,8 +838,12 @@ logview_toggle_statusbar (GtkAction *action, LogviewWindow *logview)
}
static void
-logview_toggle_sidebar (GtkAction *action, LogviewWindow *logview)
+logview_toggle_sidebar (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
{
+ LogviewWindow *logview = user_data;
+
if (gtk_widget_get_visible (logview->priv->sidebar))
gtk_widget_hide (logview->priv->sidebar);
else
@@ -804,60 +851,64 @@ logview_toggle_sidebar (GtkAction *action, LogviewWindow *logview)
}
static void
-logview_toggle_match_filters (GtkToggleAction *action, LogviewWindow *logview)
+logview_toggle_match_filters (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
{
- logview->priv->matches_only = gtk_toggle_action_get_active (action);
+
+ LogviewWindow *logview = user_data;
+
+ logview->priv->matches_only = g_variant_get_boolean (state);
+ g_simple_action_set_state (action, state);
filter_buffer (logview, 0);
}
+static void
+logview_quit (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ gtk_widget_destroy (GTK_WIDGET (user_data));
+ gtk_main_quit ();
+}
+
/* GObject functions */
/* Menus */
-
-static GtkActionEntry entries[] = {
- { "FileMenu", NULL, N_("_File"), NULL, NULL, NULL },
- { "EditMenu", NULL, N_("_Edit"), NULL, NULL, NULL },
- { "ViewMenu", NULL, N_("_View"), NULL, NULL, NULL },
- { "FilterMenu", NULL, N_("_Filters"), NULL, NULL, NULL },
- { "HelpMenu", NULL, N_("_Help"), NULL, NULL, NULL },
-
- { "OpenLog", "document-open", N_("_Open..."), "<control>O", N_("Open a log from file"),
- G_CALLBACK (logview_open_log) },
- { "CloseLog", "window-close", N_("_Close"), "<control>W", N_("Close this log"),
- G_CALLBACK (logview_close_log) },
- { "Quit", "application-exit", N_("_Quit"), "<control>Q", N_("Quit the log viewer"),
- G_CALLBACK (gtk_main_quit) },
-
- { "Copy", "edit-copy", N_("_Copy"), "<control>C", N_("Copy the selection"),
- G_CALLBACK (logview_copy) },
- { "SelectAll", NULL, N_("Select _All"), "<Control>A", N_("Select the entire log"),
- G_CALLBACK (logview_select_all) },
- { "Search", "edit-find", N_("_Find..."), "<control>F", N_("Find a word or phrase in the log"),
- G_CALLBACK (logview_search) },
-
- { "ViewZoomIn", "zoom-in", N_("Zoom _In"), "<control>plus", N_("Bigger text size"),
- G_CALLBACK (logview_bigger_text)},
- { "ViewZoomOut", "zoom-out", N_("Zoom _Out"), "<control>minus", N_("Smaller text size"),
- G_CALLBACK (logview_smaller_text)},
- { "ViewZoom100", "zoom-original", N_("_Normal Size"), "<control>0", N_("Normal text size"),
- G_CALLBACK (logview_normal_text)},
-
- { "FilterManage", NULL, N_("Manage Filters"), NULL, N_("Manage filters"),
- G_CALLBACK (logview_manage_filters)},
-
- { "HelpContents", "help-browser", N_("_Contents"), "F1", N_("Open the help contents for the log viewer"),
- G_CALLBACK (logview_help) },
- { "AboutAction", "help-about", N_("_About"), NULL, N_("Show the about dialog for the log viewer"),
- G_CALLBACK (logview_about) },
+static GActionEntry win_entries[] = {
+ { "OpenLog", logview_open_log, NULL, NULL, NULL},
+ { "CloseLog", logview_close_log, NULL, NULL, NULL},
+ { "Quit", logview_quit, NULL, NULL, NULL },
+ { "Copy", logview_copy, NULL, NULL, NULL },
+ { "SelectAll", logview_select_all, NULL, NULL, NULL },
+ { "ShowStatusBar", logview_toggle_statusbar, NULL, "true", NULL},
+ { "ShowSidebar", logview_toggle_sidebar, NULL, "true", NULL},
+ { "Search", logview_search, NULL, NULL, NULL},
+ { "ViewZoomIn", logview_bigger_text, NULL, NULL, NULL},
+ { "ViewZoomOut", logview_smaller_text, NULL, NULL, NULL},
+ { "ViewZoom100", logview_normal_text, NULL, NULL, NULL},
+ { "FilterManage", logview_manage_filters, NULL, "false", NULL},
+ { "FilterMatchOnly", activate_toggle, NULL, "false", logview_toggle_match_filters},
+ { "HelpContents", logview_help, NULL, NULL, NULL },
+ { "AboutAction", logview_about, NULL, NULL, NULL },
};
-static GtkToggleActionEntry toggle_entries[] = {
- { "ShowStatusBar", NULL, N_("_Statusbar"), NULL, N_("Show Status Bar"),
- G_CALLBACK (logview_toggle_statusbar), TRUE },
- { "ShowSidebar", NULL, N_("Side _Pane"), "F9", N_("Show Side Pane"),
- G_CALLBACK (logview_toggle_sidebar), TRUE },
- { "FilterMatchOnly", NULL, N_("Show matches only"), NULL, N_("Only show lines that match one of the given filters"),
- G_CALLBACK (logview_toggle_match_filters), FALSE}
+static const struct {
+ guint keyval;
+ GdkModifierType modifier;
+ const gchar *widget_id;
+} menu_keybindings [] = {
+ { GDK_KEY_O, GDK_CONTROL_MASK, "open_item" },
+ { GDK_KEY_W, GDK_CONTROL_MASK, "close_item" },
+ { GDK_KEY_Q, GDK_CONTROL_MASK, "quit_item" },
+ { GDK_KEY_C, GDK_CONTROL_MASK, "copy_item" },
+ { GDK_KEY_A, GDK_CONTROL_MASK, "select_item" },
+ { GDK_KEY_F9, 0, "side_item" },
+ { GDK_KEY_F, GDK_CONTROL_MASK, "find_item" },
+ { GDK_KEY_plus, GDK_CONTROL_MASK, "in_item" },
+ { GDK_KEY_minus, GDK_CONTROL_MASK, "out_item" },
+ { GDK_KEY_0, GDK_CONTROL_MASK, "normal_item" },
+ { GDK_KEY_F1, 0, "help_item" }
};
static gboolean
@@ -1121,16 +1172,6 @@ font_changed_cb (LogviewPrefs *prefs,
logview_set_font (window, font_name);
}
-static void
-tearoff_changed_cb (LogviewPrefs *prefs,
- gboolean have_tearoffs,
- gpointer user_data)
-{
- LogviewWindow *window = user_data;
-
- gtk_ui_manager_set_add_tearoffs (window->priv->ui_manager, have_tearoffs);
-}
-
static const struct {
guint keyval;
GdkModifierType modifier;
@@ -1148,7 +1189,7 @@ key_press_event_cb (GtkWidget *widget,
{
LogviewWindow *window = user_data;
guint modifier = event->state & gtk_accelerator_get_default_mod_mask ();
- GtkAction *action;
+ GAction *action;
int i;
/* handle accelerators that we want bound, but aren't associated with
@@ -1156,10 +1197,9 @@ key_press_event_cb (GtkWidget *widget,
for (i = 0; i < G_N_ELEMENTS (extra_keybindings); i++) {
if (event->keyval == extra_keybindings[i].keyval &&
modifier == extra_keybindings[i].modifier) {
-
- action = gtk_action_group_get_action (window->priv->action_group,
+ action = g_action_map_lookup_action (G_ACTION_MAP (window->priv->action_group),
extra_keybindings[i].action);
- gtk_action_activate (action);
+ g_action_activate (action, NULL);
return TRUE;
}
}
@@ -1271,16 +1311,17 @@ logview_window_finalize (GObject *object)
static void
logview_window_init (LogviewWindow *logview)
{
- GtkActionGroup *action_group;
+ GActionGroup *action_group;
GtkAccelGroup *accel_group;
GError *error = NULL;
- GtkWidget *hpaned, *main_view, *vbox, *w;
+ GtkWidget *hpaned, *main_view, *vbox, *w, *item;
PangoContext *context;
PangoFontDescription *fontdesc;
gchar *monospace_font_name;
LogviewWindowPrivate *priv;
int width, height;
gboolean res;
+ int i;
GtkStyleContext *s_context;
@@ -1299,21 +1340,21 @@ logview_window_init (LogviewWindow *logview)
gtk_container_add (GTK_CONTAINER (logview), vbox);
/* create menus */
- action_group = gtk_action_group_new ("LogviewMenuActions");
- gtk_action_group_set_translation_domain (action_group, NULL);
- gtk_action_group_add_actions (action_group, entries, G_N_ELEMENTS (entries), logview);
- gtk_action_group_add_toggle_actions (action_group, toggle_entries, G_N_ELEMENTS (toggle_entries), logview);
+ action_group = (GActionGroup*)g_simple_action_group_new ();
+ g_action_map_add_action_entries (G_ACTION_MAP (action_group),
+ win_entries, G_N_ELEMENTS (win_entries),
+ logview);
priv->action_group = action_group;
- priv->ui_manager = gtk_ui_manager_new ();
+ priv->ui_manager = gtk_builder_new ();
- gtk_ui_manager_insert_action_group (priv->ui_manager, action_group, 0);
- accel_group = gtk_ui_manager_get_accel_group (priv->ui_manager);
+ gtk_widget_insert_action_group (GTK_WIDGET (logview), "win", action_group);
+ accel_group = gtk_accel_group_new ();
gtk_window_add_accel_group (GTK_WINDOW (logview), accel_group);
- res = gtk_ui_manager_add_ui_from_resource (priv->ui_manager,
- "/org/mate/system-log/logview-toolbar.xml",
- &error);
+ res = gtk_builder_add_from_resource (priv->ui_manager,
+ "/org/mate/system-log/logview-toolbar.xml",
+ &error);
if (res == FALSE) {
priv->ui_manager = NULL;
@@ -1322,13 +1363,18 @@ logview_window_init (LogviewWindow *logview)
return;
}
- gtk_ui_manager_set_add_tearoffs (priv->ui_manager,
- logview_prefs_get_have_tearoff (priv->prefs));
-
- w = gtk_ui_manager_get_widget (priv->ui_manager, "/LogviewMenu");
+ w = (GtkWidget *)gtk_builder_get_object (priv->ui_manager, "logmenubar");
gtk_box_pack_start (GTK_BOX (vbox), w, FALSE, FALSE, 0);
gtk_widget_show (w);
+ for (i = 0; i < G_N_ELEMENTS (menu_keybindings); i++)
+ {
+ item = (GtkWidget*)gtk_builder_get_object (priv->ui_manager, menu_keybindings[i].widget_id);
+ gtk_widget_add_accelerator (item, "activate", accel_group,
+ menu_keybindings[i].keyval,
+ menu_keybindings[i].modifier,
+ GTK_ACCEL_VISIBLE);
+ }
/* panes */
hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
gtk_box_pack_start (GTK_BOX (vbox), hpaned, TRUE, TRUE, 0);
@@ -1402,7 +1448,7 @@ logview_window_init (LogviewWindow *logview)
if (priv->fontsize <= 0) {
/* restore the default */
- logview_normal_text (NULL, logview);
+ logview_normal_text (NULL, NULL, logview);
} else {
logview_set_fontsize (logview, FALSE);
}
@@ -1438,8 +1484,6 @@ logview_window_init (LogviewWindow *logview)
G_CALLBACK (window_size_changed_cb), logview);
g_signal_connect (priv->prefs, "system-font-changed",
G_CALLBACK (font_changed_cb), logview);
- g_signal_connect (priv->prefs, "have-tearoff-changed",
- G_CALLBACK (tearoff_changed_cb), logview);
g_signal_connect (priv->manager, "active-changed",
G_CALLBACK (active_log_changed_cb), logview);
g_signal_connect (logview, "key-press-event",
@@ -1454,9 +1498,8 @@ logview_window_init (LogviewWindow *logview)
gtk_widget_show (priv->statusbar);
/* Filter menu */
- priv->filter_action_group = gtk_action_group_new ("ActionGroupFilter");
- gtk_ui_manager_insert_action_group (priv->ui_manager, priv->filter_action_group,
- 1);
+ priv->filter_action_group = (GActionGroup*)g_simple_action_group_new ();
+ gtk_widget_insert_action_group (GTK_WIDGET (logview), "filter", priv->filter_action_group);
priv->active_filters = NULL;
update_filter_menu (logview);
@@ -1543,4 +1586,3 @@ logview_window_add_errors (LogviewWindow *window,
g_free (secondary);
}
-
diff --git a/logview/src/logview-window.h b/logview/src/logview-window.h
index f9fd5303..dbd5d360 100644
--- a/logview/src/logview-window.h
+++ b/logview/src/logview-window.h
@@ -1,21 +1,21 @@
-/* logview-window.h - main window of logview
- *
- * Copyright (C) 1998 Cesar Miquel <[email protected]>
+/* Copyright (C) 1998 Cesar Miquel <[email protected]>
* Copyright (C) 2008 Cosimo Cecchi <[email protected]>
+ * Copyright (C) 2012-2021 MATE Developers
+ *
+ * This file is part of MATE Utils.
*
- * This program is free software; you can redistribute it and/or modify
+ * MATE Utils 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
+ * 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,
+ * MATE Utils 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, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ * along with MATE Utils. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef __LOGVIEW_WINDOW_H__
diff --git a/logview/src/tests/Makefile.am b/logview/src/tests/Makefile.am
index 3536728c..a3def4fd 100644
--- a/logview/src/tests/Makefile.am
+++ b/logview/src/tests/Makefile.am
@@ -1,3 +1,18 @@
+# This file is part of MATE Utils.
+#
+# MATE Utils 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.
+#
+# MATE Utils 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 MATE Utils. If not, see <https://www.gnu.org/licenses/>.
+
AM_CPPFLAGS = \
$(GLIB_CFLAGS) \
$(GIO_CFLAGS) \
diff --git a/logview/src/tests/test-reader.c b/logview/src/tests/test-reader.c
index e4e9dd9d..9c174a1e 100644
--- a/logview/src/tests/test-reader.c
+++ b/logview/src/tests/test-reader.c
@@ -1,3 +1,19 @@
+/* This file is part of MATE Utils.
+ *
+ * MATE Utils 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.
+ *
+ * MATE Utils 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 MATE Utils. If not, see <https://www.gnu.org/licenses/>.
+ */
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif