Skip to content

Commit

Permalink
- Code cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
aarnt committed Nov 30, 2021
1 parent af90679 commit 47f2afa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 68 deletions.
2 changes: 1 addition & 1 deletion po/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Badwolf 1.2.1+gfc5ff73.main\n"
"Report-Msgid-Bugs-To: [email protected]\n"
"POT-Creation-Date: 2021-11-24 21:33-0300\n"
"POT-Creation-Date: 2021-11-30 10:34-0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down
70 changes: 6 additions & 64 deletions tabstack.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,9 @@
struct tabstack *prev = NULL;
struct tabstack *top = NULL;

/*int main()
{
int n, ch;
do
{
printf("\n\nStack Menu\n1. Push \n2. Pop\n3. Display\n0. Exit");
printf("\nEnter Choice 0-3? : ");
scanf("%d", &ch);
switch (ch)
{
case 1:
printf("\nEnter number ");
scanf("%d", &n);
push(n);
break;
case 2:
pop();
break;
case 3:
display();
break;
}
}while (ch != 0);
}*/
/*
* This is the structure that controls the list of last visited tabs
*/

/*
* Stacks the given tab widget visited by the user
Expand All @@ -36,11 +15,10 @@ void tabstack_push(GtkWidget *item)
struct tabstack *nptr = malloc(sizeof(struct tabstack));
nptr->data = item;

printf("Pushed gtkWidget: 0x%" PRIXPTR "\n", (uintptr_t)nptr->data);
//printf("Pushed gtkWidget: 0x%" PRIXPTR "\n", (uintptr_t)nptr->data);
nptr->prev = top;
prev = top;
nptr->next = top;
//nptr->isRemoved = FALSE;
top = nptr;
}

Expand All @@ -65,16 +43,8 @@ gint tabstack_pop(GtkNotebook *notebook)
}
else
{
/*if (temp->data != NULL) //isRemoved)
{
tabtogo = gtk_notebook_page_num(notebook, temp->data);
top = top->next;
return tabtogo;
}*/

while (temp != NULL)
{
//printf("Stack item is NULL!!!\n");
if (temp->data == NULL)
{
prev = top;
Expand All @@ -84,49 +54,21 @@ gint tabstack_pop(GtkNotebook *notebook)
else break;
}

//printf("Almost done in POP!\n");
printf("Planing to focus gtkWidget: 0x%" PRIXPTR "\n", (uintptr_t)temp->data);
//printf("Planing to focus gtkWidget: 0x%" PRIXPTR "\n", (uintptr_t)temp->data);
tabtogo = gtk_notebook_page_num(notebook, temp->data);
printf("TAB TO GO: %d\n", tabtogo);
//top = top->next;
//printf("TAB TO GO: %d\n", tabtogo);
}

return tabtogo;
}

/*
* Marks given itemToRemove item with a "isRemoved" = TRUE on the stack
*/
void tabstack_remove(GtkWidget *itemToRemove)
{
struct tabstack *temp, *bkpTop;
bkpTop = top;
temp = top;

while (temp != NULL)
{
if (temp->data == itemToRemove)
{
//printf("Tentando remover GtkWidget: 0x%" PRIXPTR "\n", (uintptr_t)itemToRemove);
//printf("Data eh: 0x%" PRIXPTR "\n", (uintptr_t)temp->data);
//temp->isRemoved = TRUE;
}

temp = temp->next;
}

top = bkpTop;
}

void
notebookPage_removed(GtkNotebook* self, GtkWidget* child, guint page_num, gpointer user_data)
{
(void)child;
(void)page_num;
(void)user_data;

//tabstack_remove(child);

if (g_bkp_current_page == -1) //User was in the tab that was closed!!!
{
gint tabToGo = tabstack_pop(self);
Expand Down
3 changes: 0 additions & 3 deletions tabstack.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,10 @@ struct tabstack
GtkWidget *data;
struct tabstack *prev;
struct tabstack *next;
//gboolean isRemoved;
};

//void display();
void tabstack_push(GtkWidget *);
gint tabstack_pop();
void tabstack_remove(GtkWidget *);

void
notebookPage_removed(GtkNotebook* self, GtkWidget* child, guint page_num, gpointer user_data);
Expand Down

0 comments on commit 47f2afa

Please sign in to comment.