summaryrefslogtreecommitdiff
path: root/libslab
diff options
context:
space:
mode:
Diffstat (limited to 'libslab')
-rw-r--r--libslab/app-resizer.c4
-rw-r--r--libslab/app-shell.c17
-rw-r--r--libslab/bookmark-agent.c93
-rw-r--r--libslab/slab-mate-util.c2
-rw-r--r--libslab/system-tile.c8
5 files changed, 67 insertions, 57 deletions
diff --git a/libslab/app-resizer.c b/libslab/app-resizer.c
index a77183b3..350b62cf 100644
--- a/libslab/app-resizer.c
+++ b/libslab/app-resizer.c
@@ -48,6 +48,10 @@ app_resizer_class_init (AppResizerClass * klass)
static void
app_resizer_init (AppResizer * window)
{
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (window)),
+ GTK_STYLE_CLASS_VIEW);
+#endif
}
void
diff --git a/libslab/app-shell.c b/libslab/app-shell.c
index 19d98bf2..45e6feae 100644
--- a/libslab/app-shell.c
+++ b/libslab/app-shell.c
@@ -26,9 +26,6 @@
#include <gio/gio.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
-#if GTK_CHECK_VERSION (3, 0, 0)
-#include <gdk/gdkkeysyms-compat.h>
-#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
@@ -198,7 +195,7 @@ launch_selected_app (AppShellData * app_data)
static gboolean
main_keypress_callback (GtkWidget * widget, GdkEventKey * event, AppShellData * app_data)
{
- if (event->keyval == GDK_Return)
+ if (event->keyval == GDK_KEY_Return)
{
SlabSection *section = SLAB_SECTION (app_data->filter_section);
NldSearchBar *search_bar;
@@ -214,9 +211,9 @@ main_keypress_callback (GtkWidget * widget, GdkEventKey * event, AppShellData *
}
/* quit on ESC or Ctl-W or Ctl-Q */
- if (event->keyval == GDK_Escape ||
- ((event->keyval == GDK_w || event->keyval == GDK_W) && (event->state & GDK_CONTROL_MASK)) ||
- ((event->keyval == GDK_q || event->keyval == GDK_Q) && (event->state & GDK_CONTROL_MASK)))
+ if (event->keyval == GDK_KEY_Escape ||
+ ((event->keyval == GDK_KEY_w || event->keyval == GDK_KEY_W) && (event->state & GDK_CONTROL_MASK)) ||
+ ((event->keyval == GDK_KEY_q || event->keyval == GDK_KEY_Q) && (event->state & GDK_CONTROL_MASK)))
{
if (app_data->exit_on_close)
gtk_main_quit ();
@@ -1184,6 +1181,12 @@ generate_new_apps (AppShellData * app_data)
{
g_object_unref (file);
g_warning ("Cant get vfs info for %s\n", uri);
+ if (new_apps_category) {
+ g_free (new_apps_category->category);
+ g_free (new_apps_category);
+ }
+ g_free (all_apps_file_name);
+ g_strfreev (all_apps_split);
return;
}
filetime = (long) g_file_info_get_attribute_uint64 (info,
diff --git a/libslab/bookmark-agent.c b/libslab/bookmark-agent.c
index b78db7b7..02e49c0c 100644
--- a/libslab/bookmark-agent.c
+++ b/libslab/bookmark-agent.c
@@ -1073,43 +1073,40 @@ create_doc_item (BookmarkAgent *this, const gchar *uri)
BookmarkAgentPrivate *priv = PRIVATE (this);
gchar *uri_new = NULL;
- gchar *path;
- gchar *dir;
- gchar *file;
- gchar *template = NULL;
- gsize length;
- gchar *contents;
+ if ((strcmp (uri, "BLANK_SPREADSHEET") == 0) || (strcmp (uri, "BLANK_DOCUMENT") == 0)) {
+ gchar *template = NULL;
+ gchar *file;
- if (! (strcmp (uri, "BLANK_SPREADSHEET") && strcmp (uri, "BLANK_DOCUMENT"))) {
- dir = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS));
- if (! dir)
+ gchar *dir = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS));
+ if (!dir)
dir = g_build_filename (g_get_home_dir (), "Documents", NULL);
- if (! strcmp (uri, "BLANK_SPREADSHEET")) {
+ if (strcmp (uri, "BLANK_SPREADSHEET") == 0) {
g_bookmark_file_set_title (priv->store, uri, "BLANK_SPREADSHEET");
file = g_strconcat (_("New Spreadsheet"), ".ots", NULL);
template = find_package_data_file (CALC_TEMPLATE_FILE_NAME);
- }
- else {
+ } else {
g_bookmark_file_set_title (priv->store, uri, "BLANK_DOCUMENT");
file = g_strconcat (_("New Document"), ".ott", NULL);
template = find_package_data_file (WRITER_TEMPLATE_FILE_NAME);
}
- path = g_build_filename (dir, file, NULL);
-
- if (! g_file_test (path, G_FILE_TEST_EXISTS)) {
+ gchar *path = g_build_filename (dir, file, NULL);
+ if (!g_file_test (path, G_FILE_TEST_EXISTS)) {
g_mkdir_with_parents (dir, 0700);
if (template != NULL) {
- if (g_file_get_contents (template, & contents, & length, NULL))
+ gchar *contents;
+ gsize length;
+
+ if (g_file_get_contents (template, &contents, &length, NULL))
g_file_set_contents (path, contents, length, NULL);
g_free (contents);
- }
- else
+ } else {
fclose (g_fopen (path, "w"));
+ }
}
uri_new = g_filename_to_uri (path, NULL, NULL);
@@ -1120,7 +1117,7 @@ create_doc_item (BookmarkAgent *this, const gchar *uri)
g_free (template);
}
- if (! uri_new)
+ if (!uri_new)
return;
if (libslab_strcmp (uri, uri_new))
@@ -1135,52 +1132,49 @@ create_dir_item (BookmarkAgent *this, const gchar *uri)
BookmarkAgentPrivate *priv = PRIVATE (this);
gchar *uri_new = NULL;
- gchar *path;
+ gchar *path = NULL;
gchar *name = NULL;
gchar *icon = NULL;
- gchar *buf;
- gchar *tag_open_ptr = NULL;
- gchar *tag_close_ptr = NULL;
gchar *search_string = NULL;
- if (! strcmp (uri, "HOME")) {
+ gboolean gotta_free_name = FALSE;
+
+ if (strcmp (uri, "HOME") == 0) {
uri_new = g_filename_to_uri (g_get_home_dir (), NULL, NULL);
- name = g_strdup (C_("Home folder", "Home"));
- icon = "user-home";
- }
- else if (! strcmp (uri, "DOCUMENTS")) {
+ name = g_strdup (C_("Home folder", "Home"));
+ gotta_free_name = TRUE;
+ icon = "user-home";
+ } else if (strcmp (uri, "DOCUMENTS") == 0) {
path = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS));
- if (! path)
+ if (!path)
path = g_build_filename (g_get_home_dir (), "Documents", NULL);
name = _("Documents");
uri_new = g_filename_to_uri (path, NULL, NULL);
- g_free (path);
- }
- else if (! strcmp (uri, "DESKTOP")) {
+ } else if (strcmp (uri, "DESKTOP") == 0) {
path = g_strdup (g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP));
- if (! path)
+ if (!path)
path = g_build_filename (g_get_home_dir (), "Desktop", NULL);
name = _("Desktop");
uri_new = g_filename_to_uri (path, NULL, NULL);
icon = "user-desktop";
- g_free (path);
- }
- else if (! strcmp (uri, "file:///")) {
+ } else if (strcmp (uri, "file:///") == 0) {
icon = "drive-harddisk";
name = _("File System");
- }
- else if (! strcmp (uri, "network:")) {
+ } else if (strcmp (uri, "network:") == 0) {
icon = "network-workgroup";
name = _("Network Servers");
- }
- else if (g_str_has_prefix (uri, "x-caja-search")) {
+ } else if (g_str_has_prefix (uri, "x-caja-search")) {
icon = "system-search";
path = g_build_filename (g_get_home_dir (), ".caja", "searches", & uri [21], NULL);
if (g_file_test (path, G_FILE_TEST_EXISTS)) {
- g_file_get_contents (path, & buf, NULL, NULL);
+ gchar *buf = NULL;
+ g_file_get_contents (path, &buf, NULL, NULL);
+
+ gchar *tag_open_ptr = NULL;
+ gchar *tag_close_ptr = NULL;
if (buf) {
tag_open_ptr = strstr (buf, "<text>");
@@ -1189,21 +1183,19 @@ create_dir_item (BookmarkAgent *this, const gchar *uri)
if (tag_open_ptr && tag_close_ptr) {
tag_close_ptr [0] = '\0';
-
- search_string = g_strdup_printf ("\"%s\"", & tag_open_ptr [6]);
-
tag_close_ptr [0] = 'a';
+ search_string = g_strdup_printf ("\"%s\"", &tag_open_ptr[6]);
}
g_free (buf);
}
- if (search_string)
+ if (search_string) {
name = search_string;
- else
+ gotta_free_name = TRUE;
+ } else {
name = _("Search");
-
- g_free (path);
+ }
}
if (icon)
@@ -1215,6 +1207,11 @@ create_dir_item (BookmarkAgent *this, const gchar *uri)
if (uri_new && libslab_strcmp (uri, uri_new))
g_bookmark_file_move_item (priv->store, uri, uri_new, NULL);
+ if (gotta_free_name) {
+ g_free (name);
+ }
+
+ g_free (path);
g_free (uri_new);
}
diff --git a/libslab/slab-mate-util.c b/libslab/slab-mate-util.c
index a4527dc0..2acf9d0c 100644
--- a/libslab/slab-mate-util.c
+++ b/libslab/slab-mate-util.c
@@ -127,7 +127,7 @@ open_desktop_item_exec (MateDesktopItem * desktop_item)
if (!desktop_item)
return FALSE;
- mate_desktop_item_launch (desktop_item, NULL, MATE_DESKTOP_ITEM_LAUNCH_ONLY_ONE, &error);
+ mate_desktop_item_launch (desktop_item, NULL, MATE_DESKTOP_ITEM_LAUNCH_ONLY_ONE | MATE_DESKTOP_ITEM_LAUNCH_DO_NOT_REAP_CHILD, &error);
if (error)
{
diff --git a/libslab/system-tile.c b/libslab/system-tile.c
index 995754ef..598e6aa7 100644
--- a/libslab/system-tile.c
+++ b/libslab/system-tile.c
@@ -93,8 +93,14 @@ system_tile_new (const gchar *desktop_item_id, const gchar *title)
mate_desktop_item_get_localestring (desktop_item, "Name"));
}
- if (! uri)
+ if (!uri) {
+ g_free (header_txt);
+ g_free (image_id);
+ if (desktop_item) {
+ mate_desktop_item_unref (desktop_item);
+ }
return NULL;
+ }
header = create_header (header_txt);