Diff of /trunk/src/cache.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 166 by harbaum, Sun Nov 8 20:34:22 2009 UTC revision 167 by harbaum, Mon Nov 9 07:50:37 2009 UTC
# Line 263  static GtkWidget *cache_overview(cache_c Line 263  static GtkWidget *cache_overview(cache_c
263    }    }
264    
265    /* --------------------- GCVote ------------------------ */    /* --------------------- GCVote ------------------------ */
266      if(!appdata->disable_gcvote) {
267    vote_t *vote = gcvote_restore(appdata, cache);      vote_t *vote = gcvote_restore(appdata, cache);
268    
269    context->gcvote_request =      context->gcvote_request =
270      gcvote_request(appdata, gcvote_callback, cache->url, context);        gcvote_request(appdata, gcvote_callback, cache->url, context);
271    
272    context->votebox = gtk_vbox_new(FALSE, 0);      context->votebox = gtk_vbox_new(FALSE, 0);
273    GtkWidget *align = gtk_alignment_new(0.5, 0.5, 0.0, 0.0);      GtkWidget *align = gtk_alignment_new(0.5, 0.5, 0.0, 0.0);
274    gtk_container_add(GTK_CONTAINER(align), context->votebox);      gtk_container_add(GTK_CONTAINER(align), context->votebox);
275    gtk_box_pack_start_defaults(GTK_BOX(ratebox), align);      gtk_box_pack_start_defaults(GTK_BOX(ratebox), align);
276    
277    /* fill with vote if present on disk (will also free vote) */      /* fill with vote if present on disk (will also free vote) */
278    if(vote)      if(vote)
279      gcvote_set(context, vote);        gcvote_set(context, vote);
280    
281    gtk_table_attach_defaults(GTK_TABLE(table), ratebox, 2,3,0,2);      gtk_table_attach_defaults(GTK_TABLE(table), ratebox, 2,3,0,2);
282      }
283    
284    /* ----------------------------------------------------- */    /* ----------------------------------------------------- */
285    
# Line 738  static void on_notebook_destroy(GtkWidge Line 739  static void on_notebook_destroy(GtkWidge
739    free(user_data);    free(user_data);
740  }  }
741    
742  #if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5)  #if 1 // defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5)
743  #define CUSTOM_NOTEBOOK  #define CUSTOM_NOTEBOOK
744  #endif  #endif
745    
# Line 778  static void on_notebook_button_clicked(G Line 779  static void on_notebook_button_clicked(G
779    GtkNotebook *nb =    GtkNotebook *nb =
780      GTK_NOTEBOOK(g_object_get_data(G_OBJECT(data), "notebook"));      GTK_NOTEBOOK(g_object_get_data(G_OBJECT(data), "notebook"));
781    
782    /* get previously selected page */    gint page = (gint)g_object_get_data(G_OBJECT(button), "page");
   gint page = gtk_notebook_get_current_page(nb);  
   char *id_str = g_strdup_printf("button_%d", page);  
   gtk_toggle_button_set_active(  
      GTK_TOGGLE_BUTTON(g_object_get_data(G_OBJECT(data), id_str)), FALSE);  
   g_free(id_str);  
   
   page = (gint)g_object_get_data(G_OBJECT(button), "page");  
783    gtk_notebook_set_current_page(nb, page);    gtk_notebook_set_current_page(nb, page);
784  }  }
785    
# Line 796  static void notebook_append_page(GtkWidg Line 790  static void notebook_append_page(GtkWidg
790      GTK_NOTEBOOK(g_object_get_data(G_OBJECT(notebook), "notebook"));      GTK_NOTEBOOK(g_object_get_data(G_OBJECT(notebook), "notebook"));
791    
792    gint page_num = gtk_notebook_append_page(nb, page, gtk_label_new(label));    gint page_num = gtk_notebook_append_page(nb, page, gtk_label_new(label));
793      GtkWidget *button = NULL;
   GtkWidget *button = gtk_toggle_button_new_with_label(label);  
   g_object_set_data(G_OBJECT(button), "page", (gpointer)page_num);  
794    
795    /* select button for page 0 by default */    /* select button for page 0 by default */
796    if(!page_num)    if(!page_num) {
797        button = gtk_radio_button_new_with_label(NULL, label);
798      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
799        g_object_set_data(G_OBJECT(notebook), "group_master", (gpointer)button);
800      } else {
801        GtkWidget *master = g_object_get_data(G_OBJECT(notebook), "group_master");
802        button = gtk_radio_button_new_with_label_from_widget(
803                                     GTK_RADIO_BUTTON(master), label);
804      }
805    
806      gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(button), FALSE);
807      g_object_set_data(G_OBJECT(button), "page", (gpointer)page_num);
808    
809    gtk_signal_connect(GTK_OBJECT(button), "clicked",    gtk_signal_connect(GTK_OBJECT(button), "clicked",
810             GTK_SIGNAL_FUNC(on_notebook_button_clicked), notebook);             GTK_SIGNAL_FUNC(on_notebook_button_clicked), notebook);
811    
   g_object_set_data(G_OBJECT(button), "page", (gpointer)page_num);  
   
812  #if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR == 5)  #if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR == 5)
813    hildon_gtk_widget_set_theme_size(button,    hildon_gtk_widget_set_theme_size(button,
814             (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH));             (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH));
815  #endif  #endif
816    
   char *id_str = g_strdup_printf("button_%d", page_num);  
   g_object_set_data(G_OBJECT(notebook), id_str, (gpointer)button);  
   g_free(id_str);  
   
817    gtk_box_pack_start_defaults(    gtk_box_pack_start_defaults(
818       GTK_BOX(g_object_get_data(G_OBJECT(notebook), "hbox")),       GTK_BOX(g_object_get_data(G_OBJECT(notebook), "hbox")),
819       button);       button);

Legend:
Removed from v.166  
changed lines
  Added in v.167