contentLister/inc/control_share.h File Reference

control - handle input and keep state More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define XMLNODE_STARTPAGE   "/package/metadata/y-metadata/startpage"
#define XMLNODE_DOCUMENT_SIGNING_PARENT   "/package/metadata/y-metadata"
#define XMLNODE_DOCUMENT_SIGNING_NODENAME   "document-signing"
#define XMLNODE_DOCUMENT_SIGNING   XMLNODE_DOCUMENT_SIGNING_PARENT "/" XMLNODE_DOCUMENT_SIGNING_NODENAME
#define TARFILE_EXTENSION   ".tar.gz"
#define SIGNATURE_EXTENSION   ".tar.gz.sha1"

Functions

void ctrl_listItem_share (const int *index_tbl, ContentLister *theContentLister)
void ctrl_doc_share_now (ContentLister *theContentLister)
void ctrl_hide_sel_list_wnd (ContentLister *theContentLister, gboolean bSave)


Detailed Description

control - handle input and keep state

<File description>="">

Definition in file control_share.h.


Define Documentation

#define SIGNATURE_EXTENSION   ".tar.gz.sha1"

Definition at line 46 of file control_share.h.

#define TARFILE_EXTENSION   ".tar.gz"

Definition at line 45 of file control_share.h.

#define XMLNODE_DOCUMENT_SIGNING   XMLNODE_DOCUMENT_SIGNING_PARENT "/" XMLNODE_DOCUMENT_SIGNING_NODENAME

Definition at line 43 of file control_share.h.

#define XMLNODE_DOCUMENT_SIGNING_NODENAME   "document-signing"

Definition at line 42 of file control_share.h.

#define XMLNODE_DOCUMENT_SIGNING_PARENT   "/package/metadata/y-metadata"

Definition at line 41 of file control_share.h.

#define XMLNODE_STARTPAGE   "/package/metadata/y-metadata/startpage"

Definition at line 40 of file control_share.h.


Function Documentation

void ctrl_doc_share_now ( ContentLister theContentLister  ) 

Definition at line 266 of file control_share.c.

00267 {
00268     CL_CONTROLPRINTF("entry");
00269 
00270     gchar* szContainerName;
00271     gchar* cp;
00272     
00273     if (   g_selectionList           != NULL
00274         && g_item_to_be_shared.index >= 0   )
00275     {
00276         clDisplayItem_t* theItem = theContentLister->items + g_item_to_be_shared.index;
00277 
00278         erbusy_blink();
00279 
00280         // save selection lists, hide screen
00281         ctrl_hide_sel_list_wnd(theContentLister, TRUE);  
00282 
00283         // sign document, when needed
00284         if (g_item_to_be_shared.do_sign)
00285         {
00286             // show pincode screen
00287             ctrl_show_pincode_screen(signDocument_t, ctrl_sign_pincode_ok, ctrl_sign_pincode_quit);
00288         }
00289         else
00290         {
00291             // determine containername
00292             szContainerName = alloca( strlen(theItem->szManifest) + 1 );
00293             g_assert(szContainerName != NULL);
00294             strcpy(szContainerName, theItem->szManifest);
00295             cp = strrchr(szContainerName, '/');
00296             g_return_if_fail(cp != NULL);
00297             *cp = '\0';
00298             
00299             // move/copy document to outbox
00300             ctrl_send_to_outbox(szContainerName, g_item_to_be_shared.do_move);
00301             if (g_item_to_be_shared.do_move)
00302             {
00303                 ctrl_rescan_current();
00304             }
00305 
00306             // no more signing to do
00307             g_item_to_be_shared.index = -1;
00308         }
00309     }
00310 }

Here is the call graph for this function:

void ctrl_hide_sel_list_wnd ( ContentLister theContentLister,
gboolean  bSave 
)

Definition at line 819 of file control_share.c.

00820 {
00821     CL_CONTROLPRINTF("entry bSave[%d]", bSave);
00822 
00823     const mdsSelection_t*  selection = NULL;
00824     erGtkSelectionGroup*   sel_group;
00825 
00826     int  sel_num;   // number of selections
00827     int  sel_idx;   // selection index
00828     int  item_num;  // number of items
00829     int  item_idx;  // item index
00830 
00831     int        button_idx;
00832     gint*      button_ids    = NULL;
00833     gboolean*  button_states = NULL;
00834 
00835 
00836     if ( (getListerState() == STATE_MISC) 
00837           && (theContentLister->distListWnd)
00838           && GTK_WIDGET_VISIBLE(theContentLister->distListWnd) )
00839     {
00840         // save states from selection lists
00841         if (bSave  &&  g_selectionList  &&  g_selection_groups)
00842         {
00843             sel_num   = g_selectionList->num_selections;
00844             selection = g_selectionList->selections;
00845             for (sel_idx = 0 ; sel_idx < sel_num ; sel_idx++, selection++)
00846             {
00847                 item_num  = selection->num_items;
00848                 sel_group = g_selection_groups[sel_idx];
00849 
00850                 // update XML item states from button states
00851                 if (selection->constant == FALSE  &&  sel_group)
00852                 {
00853                     button_ids    = alloca(item_num * sizeof(gint)    );
00854                     button_states = alloca(item_num * sizeof(gboolean));
00855                     g_assert(button_ids    != NULL);
00856                     g_assert(button_states != NULL);
00857                     ergtk_selection_group_get_selected_buttons(ERGTK_SELECTION_GROUP(sel_group), button_ids, item_num);
00858 
00859                     // set item state
00860                     // Note: button_ids[] sorted chronologically, NOT on button_id value
00861                     //   set all items to FALSE
00862                     for (item_idx = 0 ; item_idx < item_num ; item_idx++)
00863                     {
00864                         button_states[item_idx] = FALSE;
00865                     }
00866                     //   set selected items to TRUE
00867                     for (button_idx = 0 ; button_idx < item_num ; button_idx++)
00868                     {
00869                         item_idx = button_ids[button_idx];
00870                         if (item_idx >= 0  &&  item_idx < item_num)
00871                         {
00872                             button_states[item_idx] = TRUE;
00873                         }
00874                     }
00875                     //   update XML according to states
00876                     for (item_idx = 0 ; item_idx < item_num ; item_idx++)
00877                     {
00878                         erClXmlSetSelectionItem(g_selectionList, sel_idx, item_idx, button_states[item_idx]);
00879                     }
00880                 }
00881             }
00882 
00883             // save updated states to manifest file
00884             erClXmlSaveSelectionList(g_selectionList);
00885         }
00886 
00887         // get special values from selection lists
00888         erClXmlGetSelectionListItemState(g_selectionList, SELECTION_TRANSFER_MODE,    ITEM_TRANSFER_MOVE, &g_item_to_be_shared.do_move);
00889         erClXmlGetSelectionListItemState(g_selectionList, SELECTION_DOCUMENT_SIGNING, ITEM_SIGN_YES,      &g_item_to_be_shared.do_sign);
00890 
00891         // hide distribution list window
00892         dist_list_wnd_clear();
00893         gtk_widget_hide(theContentLister->distListWnd);
00894 
00895         // re-display all items
00896         ctrl_rescan_current();
00897 
00898         // show contentlister page
00899         gtk_widget_show(theContentLister->listerArea);
00900         gtk_widget_grab_focus(theContentLister->listerArea);
00901         setListerState(STATE_NORMAL);
00902     }
00903 
00904     // free g_selectionList
00905     erClXmlFreeSelectionList(g_selectionList);
00906     g_selectionList = NULL;
00907 
00908     // free g_selection_groups
00909     g_free(g_selection_groups);
00910     g_selection_groups = NULL;
00911 
00912     CL_CONTROLPRINTF("leave");
00913 }

Here is the call graph for this function:

void ctrl_listItem_share ( const int *  index_tbl,
ContentLister theContentLister 
)

Definition at line 211 of file control_share.c.

00212 {
00213     gboolean         ok;
00214 
00215     CL_CONTROLPRINTF("entry: index [%d]", *index_tbl);
00216     g_assert(theContentLister != NULL);
00217 
00218     // find out which item must be shared
00219     const int  index = *index_tbl;  // only one item expected
00220     g_assert(index >= 0  &&  index < theContentLister->itemCount);
00221 
00222     // and set a pointer to the item details
00223     clDisplayItem_t* theItem = theContentLister->items + index;
00224 
00225     erbusy_blink();
00226 
00227     // update the stored index value
00228     mdsSetIndex(theContentLister->currentContentType, index + ((theContentLister->currentPage - 1) * MAX_ITEMS_ON_ONE_PAGE));
00229 
00230     // remember which item we are sharing
00231     g_item_to_be_shared.index            = index;
00232     g_item_to_be_shared.do_move          = FALSE;
00233     g_item_to_be_shared.do_sign          = FALSE;
00234     g_item_to_be_shared.theContentLister = theContentLister;
00235 
00236     // convert file to container
00237     if (theItem->fit == mdsFitFile)
00238     {
00239         ctrl_before_file_clicked(theItem);
00240     }
00241 
00242     // show selection list window
00243     if (theItem->fit == mdsFitContainer)
00244     {
00245         display_update_increase_level(MAIN_WINDOW_EXPOSE_LEVEL);
00246         ok = ctrl_show_sel_list_wnd(index, theContentLister);
00247         if (ok)
00248         {
00249             display_update_request_screen_refresh(MAIN_WINDOW_EXPOSE_LEVEL);
00250         }
00251         else
00252         {
00253             CL_WARNPRINTF("-- cannot show dist_list_wnd");
00254             toolbar_setIconState(iconID_share, iconState_normal);
00255             toolbar_synchronise();
00256         }
00257     }
00258     else
00259     {
00260         CL_WARNPRINTF("-- not allowed to share item [%s] fit [%d] ", theItem->szFilename, theItem->fit);
00261         toolbar_setIconState(iconID_share, iconState_normal);
00262         toolbar_synchronise();
00263     }
00264 }

Here is the call graph for this function:


Generated on Sun Dec 14 17:12:47 2008 by  doxygen 1.5.6