Commit fdc5894095433b8099e253ecd0cc2c71e02023be

Authored by Perry Werneck
1 parent f0bbb4f6

Playing with the toolbar settings.

Showing 1 changed file with 35 additions and 5 deletions   Show diff stats
src/objects/toolbar/toolbar.c
... ... @@ -457,16 +457,46 @@
457 457  
458 458 void pw3270_toolbar_set_actions(GtkWidget *toolbar, const gchar *action_names) {
459 459  
460   - gchar ** actions = g_strsplit(action_names,",",-1);
461   - size_t ix;
  460 + size_t ix;
  461 + gint pos = 0;
  462 +
  463 + gchar ** blocks = g_strsplit(action_names,":",-1);
462 464  
463 465 gtk_container_remove_all(GTK_CONTAINER(toolbar));
464 466  
465   - for(ix = 0; actions[ix]; ix++) {
466   - pw3270_toolbar_insert_action(toolbar,actions[ix],-1);
  467 + // Left block
  468 + {
  469 + gchar ** actions = g_strsplit(blocks[0],",",-1);
  470 +
  471 + for(ix = 0; actions[ix]; ix++) {
  472 + pw3270_toolbar_insert_action(toolbar,actions[ix],pos++);
  473 + }
  474 +
  475 + g_strfreev(actions);
  476 +
  477 + }
  478 +
  479 + // Right block
  480 + if(blocks[1]) {
  481 +
  482 + GtkToolItem * item = gtk_separator_tool_item_new();
  483 +
  484 + gtk_separator_tool_item_set_draw(GTK_SEPARATOR_TOOL_ITEM(item),FALSE);
  485 + gtk_tool_item_set_expand(item,TRUE);
  486 + gtk_toolbar_insert(GTK_TOOLBAR(toolbar), item,pos++);
  487 +
  488 + gchar ** actions = g_strsplit(blocks[1],",",-1);
  489 +
  490 + for(ix = 0; actions[ix]; ix++) {
  491 + pw3270_toolbar_insert_action(toolbar,actions[ix],pos++);
  492 + }
  493 +
  494 + g_strfreev(actions);
  495 +
467 496 }
468 497  
469   - g_strfreev(actions);
  498 + g_strfreev(blocks);
  499 +
470 500  
471 501 g_object_notify(G_OBJECT(toolbar), "action-names");
472 502  
... ...