]> git.mdlowis.com Git - proto/labwc.git/commitdiff
project wide: adapt to new non-NULL value of view_get_string_prop()
authorConsolatis <35009135+Consolatis@users.noreply.github.com>
Sun, 29 Dec 2024 01:18:27 +0000 (02:18 +0100)
committerJohan Malm <johanmalm@users.noreply.github.com>
Sun, 29 Dec 2024 13:06:30 +0000 (13:06 +0000)
src/debug.c
src/desktop-entry.c
src/osd-field.c
src/view.c

index 37ac533c10e73b49e6be55c454f5a2c168eb65d9..ceabbd54a24196fe277f4b5896513335ab3e1115 100644 (file)
@@ -3,6 +3,7 @@
 #include <wlr/types/wlr_scene.h>
 #include "common/graphic-helpers.h"
 #include "common/scene-helpers.h"
+#include "common/string-helpers.h"
 #include "debug.h"
 #include "input/ime.h"
 #include "labwc.h"
@@ -69,7 +70,7 @@ get_view_part(struct view *view, struct wlr_scene_node *node)
        }
        if (node == &view->scene_tree->node) {
                const char *app_id = view_get_string_prop(view, "app_id");
-               if (!app_id) {
+               if (!string_null_or_empty(app_id)) {
                        return "view";
                }
                snprintf(view_name, sizeof(view_name), "view (%s)", app_id);
index fe5c23796517901ca7c59c12c33088aafae1bd01..b4bc9d943990b4a1f54c43b762b7d9f2108632c4 100644 (file)
@@ -280,6 +280,10 @@ struct lab_img *
 desktop_entry_icon_lookup(struct server *server, const char *app_id, int size,
                float scale)
 {
+       if (string_null_or_empty(app_id)) {
+               return NULL;
+       }
+
        struct sfdo *sfdo = server->sfdo;
        if (!sfdo) {
                return NULL;
@@ -328,6 +332,10 @@ desktop_entry_icon_lookup(struct server *server, const char *app_id, int size,
 const char *
 desktop_entry_name_lookup(struct server *server, const char *app_id)
 {
+       if (string_null_or_empty(app_id)) {
+               return NULL;
+       }
+
        struct sfdo *sfdo = server->sfdo;
        if (!sfdo) {
                return NULL;
index 926f908f2947ee210713d065f7b064d6dd60ef09..8da1933d9f7f04be2248e6f77ec6ac16345077b2 100644 (file)
@@ -37,7 +37,7 @@ get_app_id_or_class(struct view *view, bool trim)
        const char *identifier = view_get_string_prop(view, "app_id");
 
        /* remove the first two nodes of 'org.' strings */
-       if (trim && identifier && !strncmp(identifier, "org.", 4)) {
+       if (trim && !strncmp(identifier, "org.", 4)) {
                char *p = (char *)identifier + 4;
                p = strchr(p, '.');
                if (p) {
index 209dd7fa9912710ea2baab29d84cdf9e42a87fcb..344bc05bf8167489226011816a541fd3ed0b9179 100644 (file)
@@ -2352,12 +2352,7 @@ void
 view_update_title(struct view *view)
 {
        assert(view);
-       const char *title = view_get_string_prop(view, "title");
-       if (!title) {
-               return;
-       }
        ssd_update_title(view->ssd);
-
        wl_signal_emit_mutable(&view->events.new_title, NULL);
 }
 
@@ -2365,15 +2360,9 @@ void
 view_update_app_id(struct view *view)
 {
        assert(view);
-       const char *app_id = view_get_string_prop(view, "app_id");
-       if (!app_id) {
-               return;
-       }
-
        if (view->ssd_enabled) {
                ssd_update_window_icon(view->ssd);
        }
-
        wl_signal_emit_mutable(&view->events.new_app_id, NULL);
 }