Skip to content

Commit

Permalink
more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
donpdonp committed Jan 9, 2025
1 parent 7751f04 commit 0653118
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
16 changes: 8 additions & 8 deletions src/gui/gtk3.zig
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ pub fn add_column(colInfo: *config.ColumnInfo) void {
column.guitoots = std.StringHashMap(*c.GtkBuilder).init(allocator);
columns.append(column) catch unreachable;
columns_resize();
warn("column added {s}\n", .{column.main.makeTitle()});
warn("column added {s}", .{column.main.makeTitle()});
const filter = builder_get_widget(column.builder, "column_filter");
const cFilter = util.sliceToCstr(allocator, column.main.config.filter);
c.gtk_entry_set_text(@as(*c.GtkEntry, @ptrCast(filter)), cFilter);
Expand Down Expand Up @@ -208,7 +208,7 @@ pub fn columns_resize() void {
const container = builder_get_widget(myBuilder, "ZootColumns");
const app_width = c.gtk_widget_get_allocated_width(container);
const avg_col_width = @divTrunc(app_width, @as(c_int, @intCast(columns.items.len)));
warn("columns_resize app_width {} col_width {} columns {}\n", .{ app_width, avg_col_width, columns.items.len });
warn("columns_resize app_width {} col_width {} columns {}", .{ app_width, avg_col_width, columns.items.len });
for (columns.items) |col| {
c.gtk_widget_get_allocation(col.columnbox, &myAllocation);
}
Expand Down Expand Up @@ -276,7 +276,7 @@ fn find_gui_column(c_column: *config.ColumnInfo) ?*Column {
}

pub fn update_column_toots(column: *Column) void {
warn("update_column {s} {} toots {s}\n", .{
warn("update_column {s} {} toots {s}", .{
column.main.config.title,
column.main.toots.count(),
if (column.main.inError) @as([]const u8, "ERROR") else @as([]const u8, ""),
Expand All @@ -292,7 +292,7 @@ pub fn update_column_toots(column: *Column) void {
if (tootbuilderMaybe) |kv| {
const builder = kv;
destroyTootBox(builder);
warn("update_column_toots destroyTootBox toot #{s} {*} {*}\n", .{ toot.id(), toot, builder });
warn("update_column_toots destroyTootBox toot #{s} {*} {*}", .{ toot.id(), toot, builder });
}
const tootbuilder = makeTootBox(toot, column);
const tootbox = builder_get_widget(tootbuilder, "tootbox");
Expand All @@ -304,7 +304,7 @@ pub fn update_column_toots(column: *Column) void {
const builder = kv;
const tootbox = builder_get_widget(builder, "tootbox");
c.gtk_widget_hide(tootbox);
warn("update_column_toots hide toot #{s} {*} {*}\n", .{ toot.id(), toot, builder });
warn("update_column_toots hide toot #{s} {*} {*}", .{ toot.id(), toot, builder });
}
}

Expand All @@ -319,7 +319,7 @@ pub fn update_column_toots(column: *Column) void {
}

pub fn update_netstatus_column(http: *config.HttpInfo, column: *Column) void {
warn("update_netstatus_column {s} {}\n", .{ http.url, http.response_code });
warn("update_netstatus_column {s} {}", .{ http.url, http.response_code });
const column_footer_netstatus = builder_get_widget(column.builder, "column_footer_netstatus");
const gtk_context_netstatus = c.gtk_widget_get_style_context(column_footer_netstatus);
//var netmsg: *const u8 = undefined;
Expand Down Expand Up @@ -429,7 +429,7 @@ pub fn makeTootBox(toot: *toot_lib.Type, column: *Column) *c.GtkBuilder {
}

for (toot.imgList.items) |imgdata| {
warn("toot #{s} rebuilding with img\n", .{toot.id()});
warn("toot #{s} rebuilding with img", .{toot.id()});
toot_media(column, builder, toot, imgdata);
}

Expand Down Expand Up @@ -595,7 +595,7 @@ fn main_check_resize(selfptr: *anyopaque) callconv(.C) void {
}

fn actionbar_add() callconv(.C) void {
warn("actionbar_add()\n", .{});
warn("actionbar_add()", .{});
var verb = allocator.create(thread.CommandVerb) catch unreachable;
verb.idle = undefined;
var command = allocator.create(thread.Command) catch unreachable;
Expand Down
20 changes: 10 additions & 10 deletions src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ fn oauthtokenback(command: *thread.Command) void {
gui.schedule(gui.update_column_config_oauth_finalize_schedule, @as(*anyopaque, @ptrCast(column)));
}
} else {
warn("*oauthtokenback json err body {}\n", .{http.body});
warn("*oauthtokenback json err body {}", .{http.body});
}
} else {
//warn("*oauthtokenback net err {}\n", .{http.response_code});
Expand All @@ -208,7 +208,7 @@ fn oauthback(command: *thread.Command) void {
//warn("*oauthback client id {s} secret {s}\n", .{ column.oauthClientId, column.oauthClientSecret });
gui.schedule(gui.column_config_oauth_url_schedule, @as(*anyopaque, @ptrCast(column)));
} else {
warn("*oauthback json type err {}\n{s}\n", .{ rootJsonType, http.body });
warn("*oauthback json type err {} {s}", .{ rootJsonType, http.body });
}
} else {
//warn("*oauthback net err {}\n", .{http.response_code});
Expand All @@ -228,13 +228,13 @@ fn netback(command: *thread.Command) void {
warn("netback tree is {!}", .{tree});
if (@TypeOf(tree) == std.json.Array) {
column.inError = false;
warn("netback payload is array len {}\n", .{tree.items.len});
warn("netback payload is array len {}", .{tree.items.len});
for (tree.items) |jsonValue| {
const item = jsonValue.object;
const toot = alloc.create(toot_lib.Type) catch unreachable;
toot.* = toot_lib.Type.init(item, alloc);
const id = toot.id();
warn("netback json create toot #{s} {*}\n", .{ id, toot });
warn("netback json create toot #{s} {*}", .{ id, toot });
if (column.toots.contains(toot)) {
// dupe
} else {
Expand All @@ -250,7 +250,7 @@ fn netback(command: *thread.Command) void {
const img_url_raw = image.object.get("preview_url").?;
if (img_url_raw == .string) {
const img_url = img_url_raw.string;
warn("toot #{s} has img {s}\n", .{ toot.id(), img_url });
warn("toot #{s} has img {s}", .{ toot.id(), img_url });
mediaget(toot, img_url, alloc);
} else {
warn("WARNING: image json 'preview_url' is not String: {}", .{img_url_raw});
Expand All @@ -261,7 +261,7 @@ fn netback(command: *thread.Command) void {
} else if (@TypeOf(tree) == std.json.ObjectMap) {
warn("netback json is object");
if (tree.object.get("error")) |err| {
warn("netback json err {s} \n", .{err.String});
warn("netback json err {s}", .{err.String});
}
} else {
//warn("!netback json unknown root tagtype {!}\n", .{tree});
Expand Down Expand Up @@ -348,14 +348,14 @@ fn guiback(command: *thread.Command) void {
}
if (command.id == 4) { // save config params
const column = command.verb.column;
warn("gui col config {s}\n", .{column.config.title});
warn("gui col config {s}", .{column.config.title});
column.inError = false;
column.refreshing = false;
config.writefile(settings, "config.json");
}
if (command.id == 5) { // column remove
const column = command.verb.column;
warn("gui col remove {s}\n", .{column.config.title});
warn("gui col remove {s}", .{column.config.title});
//var colpos: usize = undefined;
for (settings.columns.items, 0..) |col, idx| {
if (col == column) {
Expand All @@ -377,7 +377,7 @@ fn guiback(command: *thread.Command) void {
}
if (command.id == 7) { //oauth activate
const myAuth = command.verb.auth.*;
warn("oauth authorization {s}\n", .{myAuth.code});
warn("oauth authorization {s}", .{myAuth.code});
oauthtokenget(myAuth.column, myAuth.code, alloc);
}
if (command.id == 8) { //column config changed
Expand All @@ -400,7 +400,7 @@ fn guiback(command: *thread.Command) void {
config.writefile(settings, "config.json");
}
if (command.id == 11) { // Quit
warn("byebye...\n", .{});
warn("byebye...", .{});
std.posix.exit(0);
}
}
Expand Down

0 comments on commit 0653118

Please sign in to comment.